var egret = window.egret;var __reflect = (this && this.__reflect) || function (p, c, t) {
    p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
var __extends = this && this.__extends || function __extends(t, e) { 
 function r() { 
 this.constructor = t;
}
for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
r.prototype = e.prototype, t.prototype = new r();
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [0, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
//青蛙类
//1.生成青蛙
//2.更换青蛙的皮肤和动画
//3.更新青蛙的动画，朝向和移动位置
var daojv;
(function (daojv) {
    daojv[daojv[""] = 0] = "";
    daojv[daojv["\u9690\u8EAB"] = 1] = "\u9690\u8EAB";
    daojv[daojv["\u51CF\u901F"] = 2] = "\u51CF\u901F";
    daojv[daojv["\u526A\u5200"] = 3] = "\u526A\u5200";
    daojv[daojv["\u559D\u9152"] = 4] = "\u559D\u9152";
    daojv[daojv["\u53D8\u8272"] = 5] = "\u53D8\u8272";
    daojv[daojv["\u56FA\u5B9A\u52A0\u5206\u8377\u53F6"] = 6] = "\u56FA\u5B9A\u52A0\u5206\u8377\u53F6";
    daojv[daojv["\u6B7B\u4EA1\u52A0\u5206\u8377\u53F6"] = 7] = "\u6B7B\u4EA1\u52A0\u5206\u8377\u53F6";
    daojv[daojv["\u7729\u6655"] = 8] = "\u7729\u6655";
})(daojv || (daojv = {}));
;
var daojveff;
(function (daojveff) {
    daojveff[daojveff[""] = 0] = "";
    daojveff[daojveff["\u9690\u8EAB"] = 1] = "\u9690\u8EAB";
    daojveff[daojveff["ice"] = 2] = "ice";
    daojveff[daojveff["jiandao"] = 3] = "jiandao";
    daojveff[daojveff["drink"] = 4] = "drink";
    daojveff[daojveff["bianse"] = 5] = "bianse";
    daojveff[daojveff["\u56FA\u5B9A\u52A0\u5206\u8377\u53F6"] = 6] = "\u56FA\u5B9A\u52A0\u5206\u8377\u53F6";
    daojveff[daojveff["\u6B7B\u4EA1\u52A0\u5206\u8377\u53F6"] = 7] = "\u6B7B\u4EA1\u52A0\u5206\u8377\u53F6";
    daojveff[daojveff["xuanyun"] = 8] = "xuanyun";
})(daojveff || (daojveff = {}));
;
var ClipName;
(function (ClipName) {
    ClipName[ClipName["ice"] = 0] = "ice";
    ClipName[ClipName["jiandao"] = 1] = "jiandao";
    ClipName[ClipName["drink"] = 2] = "drink";
    ClipName[ClipName["bianse"] = 3] = "bianse";
    ClipName[ClipName["heart"] = 4] = "heart";
    ClipName[ClipName["paopao"] = 5] = "paopao";
    ClipName[ClipName["xuanyun"] = 6] = "xuanyun";
    ClipName[ClipName["miwu"] = 7] = "miwu";
    ClipName[ClipName["xinsui"] = 8] = "xinsui";
})(ClipName || (ClipName = {}));
;
var control;
(function (control) {
    var frog = (function (_super) {
        __extends(frog, _super);
        function frog(Game) {
            var _this = _super.call(this) || this;
            /**断线惩罚 */
            _this.ispunish = false;
            /**是有颜色 */
            _this.iscolour = true;
            /**表情持续时间 */
            _this.eyetime = -1;
            /**墨镜持续时间 */
            _this.eyetimeMojing = -1;
            /**青蛙眼睛 */
            _this.qineyer = 1;
            /**判断玩家升级所需的值 */
            _this.frogUpdatePeroidValue = 100;
            /**配置文件 */
            _this.c = serverConfig.config;
            /**青蛙舌长 */
            _this.frogLineLength = 0;
            /**线快断掉了 */
            _this.tu = new eui.Image();
            /**护盾外 */
            _this.shieldOuter = new eui.Image();
            /**护盾内 */
            _this.shieldInside = new eui.Image();
            /**玩家装饰 */
            _this.shipin = new eui.Image();
            _this.shipin_1 = new eui.Image();
            _this.shipin_2 = new eui.Image();
            _this.shipin_3 = new eui.Image();
            _this.shipin_4 = new eui.Image();
            _this.shipin_5 = new eui.Image();
            _this.shipin1 = new eui.Image();
            /**粒子层 */
            _this.tralingLayer = new egret.Sprite();
            /**道具效果 */
            _this.effectOfProps = new eui.Image();
            /**连杀数 */
            _this.killNum = 0;
            /**帧动画层 */
            _this.ClipLayer = new egret.Sprite();
            /**青蛙身上出现冰块图片*/
            _this.ice2 = new eui.Image();
            /** 舔到异色青蛙眼睛两边变化-头上的黑线*/
            _this.heixian = new eui.Image();
            /** 舔到异色青蛙眼睛两边变化-头顶的汗*/
            _this.han = new eui.Image();
            /** 舔到异色青蛙眼睛内变化*/
            _this.eyeLeft = new eui.Image();
            /** 舔到异色青蛙眼睛内变化-右眼*/
            _this.eyeRight = new eui.Image();
            /** 舔到异色青蛙眼睛内变化-tween动画的变化*/
            _this.eyeLR = new eui.Image();
            /**显示道具效果-状态图片 */
            _this.zhuangtai_1 = new eui.Image();
            /**添加碰撞是左右两侧的波纹(bowen)-右侧 */
            _this.bwRight = new egret.Bitmap();
            /**添加碰撞是左右两侧的波纹(bowen) -左侧*/
            _this.bwLeft = new egret.Bitmap();
            /**判断青蛙的速度*/
            _this.distanceMax = 1;
            _this.isborn = false;
            _this.speed = 5;
            /**当前道具效果  防止一直加载 */
            _this.nowPropsType = [-1, -1, -1, -1, -1, -1, -1, -1, -1];
            /**帧动画数组 */
            _this.Clip_shuzu = new Array();
            /**眩晕次数 */
            _this.xuanyunTime = 0;
            /**变色次数 */
            _this.bianseTime = 0;
            /**迷雾次数 */
            _this.miwuTime = 0;
            /**心碎次数 */
            _this.xinsuiTime = 0;
            /**震颤次数 */
            _this.zhenchanTimeRight = 0;
            _this.zhenchanTimeLeft = 0;
            _this.timeOnEnterFrame = 0;
            _this.gamePanleHandle = Game.displayContainer;
            _this.m_frogMgr = Game;
            return _this;
        }
        frog.prototype.init = function (index) {
            this.type = 0;
            this.level = 11;
            this.anchorOffsetX = this.width / 2;
            this.anchorOffsetY = this.height / 2;
            this.size = serverConfig.config.size;
            this.targetDir = egret.Point.create(0, 0);
            this.targetPoint = egret.Point.create(0, 0);
            this.curPoint = egret.Point.create(0, 0);
            this.loadRes();
            this.gamePanleHandle.addChild(this.tralingLayer);
            this.tongueInit();
            this.frogAniamtionDis = meterAanimation.getInstance().GetDragonAnimation(1);
            this.addChild(this.frogAniamtionDis);
            FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);
            this.shipinInit();
            this.jisha();
            this.displayShield();
            this.tweenOver = true;
            this.frogLineLength = AIPropsMgr.getInstance().GetAttributesByGrade(0).frogLineLength;
            this.tongueWide = AIPropsMgr.getInstance().GetAttributesByGrade(0).tongueWide;
            this.isUsed = false;
            this.userid = -1;
            this.frogId = index;
            this.visible = false;
            this.gamePanleHandle.addChild(this);
            this.gamePanleHandle.addChild(this.ClipLayer); //添加帧动画层
            this.displayFrogName();
            this.displayEffectOfProps(this.nowPropsType);
            this.targetPost = new egret.Point(0, 0);
            this.myPos = new egret.Point(0, 0);
            this.pointOver = new egret.Point(0, 0);
            this.addClip();
            this.isInRange = true;
            this.all_Image();
            this.EyesInit();
        };
        /**眼睛初始化 */
        frog.prototype.EyesInit = function () {
            this.leftEye = new egret.Bitmap();
            this.rightEye = new egret.Bitmap();
            FaceManager.GetInstance().ChangeNormalEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
        };
        /**减少内存泄漏，初始化所有图片 */
        frog.prototype.all_Image = function () {
            this.ice2.texture = resManager.getInstance().getExpressionGroups(0);
            this.heixian.texture = resManager.getInstance().getExpressionGroups(1);
            this.heixian.anchorOffsetX = this.heixian.width / 2;
            this.heixian.anchorOffsetY = this.heixian.height / 2;
            this.han.texture = resManager.getInstance().getExpressionGroups(2);
            this.han.anchorOffsetX = this.han.width / 2;
            this.han.anchorOffsetY = this.han.height / 2;
            this.eyeLeft.texture = resManager.getInstance().getExpressionGroups(3);
            this.eyeLeft.anchorOffsetX = this.eyeLeft.width / 2;
            this.eyeLeft.anchorOffsetY = this.eyeLeft.height / 2;
            this.eyeRight.texture = resManager.getInstance().getExpressionGroups(3);
            this.eyeRight.anchorOffsetX = this.eyeRight.width / 2;
            this.eyeRight.anchorOffsetY = this.eyeRight.height / 2;
            this.eyeLR.texture = resManager.getInstance().getExpressionGroups(4);
            this.zhuangtai_1.texture = resManager.getInstance().getExpressionGroups(5);
            this.bwRight.texture = resManager.getInstance().getExpressionGroups(6);
            //console.log(resManager.getInstance().getExpressionGroups(0));
            this.bwRight.anchorOffsetY = this.bwRight.height / 2;
            this.bwRight.anchorOffsetX = this.bwRight.width / 2;
            this.bwLeft.texture = resManager.getInstance().getExpressionGroups(6);
            this.bwLeft.anchorOffsetY = this.bwLeft.height / 2;
            this.bwLeft.anchorOffsetX = this.bwLeft.width / 2;
            this.shipin_1.texture = resManager.getInstance().getExpressionGroups(7);
            this.shipin_2.texture = resManager.getInstance().getExpressionGroups(8);
            this.shipin_3.texture = resManager.getInstance().getExpressionGroups(9);
            this.shipin_4.texture = resManager.getInstance().getExpressionGroups(10);
            this.shipin_5.texture = resManager.getInstance().getExpressionGroups(11);
            this.tu.texture = resManager.getInstance().getExpressionGroups(12);
        };
        frog.prototype.setInRange = function (isRange) {
            this.isInRange = isRange;
        };
        /**舌头初始化 */
        frog.prototype.tongueInit = function () {
            var tongue = new eui.Image;
            tongue.texture = resManager.getInstance().getExpressionGroups(13);
            tongue.anchorOffsetY = tongue.height / 2;
            tongue.width = 0;
            tongue.rotation = -90;
            tongue.visible = false;
            tongue.y = -40;
            this.tongue = tongue;
            this.addChild(this.tongue);
        };
        /**初始化阴影 */
        frog.prototype.shadowinint = function () {
            this.shadow = new eui.Image();
            this.shadow.scaleX = this.shadow.scaleY = 1.5;
            this.shadow.anchorOffsetX = this.width / 2;
            this.shadow.anchorOffsetY = this.height / 2;
            this.shadow.x = 0;
            this.shadow.y = -30;
            this.shadow.texture = resManager.getInstance().getExpressionGroups(14);
            this.shadow.alpha = 0.8;
            //this.shadow.visible=false;
            this.shadow.visible = true;
        };
        /**根据体型设置阴影大小 */
        frog.prototype.setShadow = function () {
            if (Math.floor(this.level / 10) == 1) {
                this.shadow.scaleX = this.shadow.scaleY = 1.5;
                this.shadow.anchorOffsetX = this.width / 2;
                this.shadow.anchorOffsetY = this.height / 2;
                this.shadow.x = 0;
                this.shadow.y = -30;
            }
            if (Math.floor(this.level / 10) == 2) {
                this.shadow.scaleX = this.shadow.scaleY = 1.6;
                this.shadow.anchorOffsetX = this.width / 2;
                this.shadow.anchorOffsetY = this.height / 2;
                this.shadow.x = 5;
                this.shadow.y = -25;
            }
            if (Math.floor(this.level / 10) == 3) {
                this.shadow.scaleX = this.shadow.scaleY = 2.2;
                this.shadow.anchorOffsetX = this.width / 2;
                this.shadow.anchorOffsetY = this.height / 2;
                this.shadow.x = 5;
                this.shadow.y = -25;
            }
            if (Math.floor(this.level / 10) == 4) {
                this.shadow.scaleX = this.shadow.scaleY = 2.3;
                this.shadow.anchorOffsetX = this.width / 2;
                this.shadow.anchorOffsetY = this.height / 2;
                this.shadow.x = 5;
                this.shadow.y = -25;
            }
        };
        frog.prototype.checkInRange = function () {
            if (DataProl.isXinShou) {
                return;
            }
            // if (this.isInRange == this.isInRangeLast) {
            // 	return;
            // }
            // else {
            this.frogName.visible = this.isInRange;
            //this.frogName.visible = false;
            this.effectOfProps.visible = this.isInRange;
            this.visible = this.isInRange;
            // }
        };
        /**玩家数据更新 */
        frog.prototype.dataUpdata = function (e) {
            if (e.states != 1) {
                this.checkInRange();
                //this.GetAttributesByGrade(e.lineLength);
                this.grade = e.grade;
                this.tongueWide = e.tongueWide;
                this.frogLineLength = e.lineLength;
                this.setTargetPoint(e);
                this.displayOrHideShield(e.NewHandProtect.isProtect);
                this.displayEffectOfProps(e.propStates);
                if (e.propStates[2].getPropType != 3) {
                    if (this.Clip_shuzu[1].visible == true) {
                        this.Clip_shuzu[1].visible = false;
                    }
                }
                /**判断玩家是否隐身 */
                if (e.propStates[0].getPropType == 1) {
                    this.frogName.alpha = 0.1;
                    this.effectOfProps.alpha = 0.1;
                    this.alpha = 0.1;
                }
                else {
                    this.frogName.alpha = 1;
                    this.alpha = 1;
                    this.effectOfProps.alpha = 0;
                }
                if (this.isInRange == true) {
                    if (this.nowPropsType[3] == daojv["喝酒"]) {
                        if (this.qineyer != 4) {
                            //this.changeClothes.changeClotheseye(this.frogAniamtionDis, 4);
                            FaceManager.GetInstance().ChangeDizzinessEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
                            this.qineyer = 4;
                            console.log(this.leftEye.texture);
                        }
                    }
                    else if (this.nowPropsType[7] == daojveff["xuanyun"]) {
                        if (this.qineyer != 4) {
                            FaceManager.GetInstance().ChangeDizzinessEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
                            this.qineyer = 4;
                        }
                    }
                    else {
                        if (this.qineyer == 4) {
                            var a = 1;
                            FaceManager.GetInstance().ChangeNormalEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
                            if (this.ispunish) {
                                a = 3;
                                FaceManager.GetInstance().ChangeCryEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
                            }
                            this.qineyer = a;
                        }
                    }
                }
                /*if (this.nowPropsType == 6||this.nowPropsType == 7)
                 {
                        this.nowPropsType=-1;
                }*/
                /**判断玩家表情结束 */
                if (this.eyetime != -1 && this.qineyer != 4 && this.qineyer != 3) {
                    if (Date.now() - this.eyetime > 500) {
                        FaceManager.GetInstance().ChangeNormalEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
                        this.eyetime = -1;
                        this.qineyer = 1;
                    }
                }
                /**判断玩家击杀（墨镜）表情结束 */
                if (this.eyetimeMojing != -1) {
                    if (Date.now() - this.eyetimeMojing > 1000) {
                        this.shipin1.visible = false;
                        this.eyetimeMojing = -1;
                    }
                }
                /**断线处罚 */
                if (!this.ispunish && e.disconnection_line) {
                    this.ispunish = true;
                    this.changeFaceEye(3, null); //00修改快断线					
                    //this.changeClothes.changeClothes(this.frogAniamtionDis, 5, this.level);
                    //   console.log("frog name"+e.name+"开始处罚")
                }
                if (this.ispunish && !e.disconnection_line) {
                    this.ispunish = false;
                    if (this.isInRange == true) {
                        FaceManager.GetInstance().ChangeNormalEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
                        this.qineyer = 1;
                    }
                    //	console.log("***********/////////****"+this.type)
                    //this.changeClothes.changeClothes(this.frogAniamtionDis, this.type, this.mainLevel, this.minLevel);
                    FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);
                    //	 console.log("frog name"+e.name+"处罚结束")
                }
                this.frogIsHadLine = e.ishadLine;
                this.DetermineKill(e.killNumber);
                if (webNetworkMananger.isServerMove) {
                    if (e.death.isDeath) {
                        this.frogDied();
                    }
                }
                else {
                    if (e.death.isDeath) {
                        if (e.propStates[3].getPropType == 3)
                            this.frogDied();
                        this.killNum = 0;
                    }
                }
                this.deathDate = e.Death;
                this.dealFrogUpgrade(e);
                if (this.isInRange == true) {
                    //道具五。。变色
                    if (webNetworkMananger.getInstance().gameSceneRec.myUser.userSprit.nowPropsType[4] == daojv["变色"]) {
                    }
                    if (this.type != e.frogType) {
                        this.type = e.frogType;
                        if (!this.ispunish) {
                            this.changeType();
                            this.nowPropsType[4] = -1;
                            AIUserMgr.getInstance().resetPlayerOnePropStates(e, 4);
                        }
                    }
                }
                /**防止两个黄色 */
                if (this.userid != DataProl.account && this.frogName.textColor != 0xffffff)
                    this.frogName.textColor = 0xffffff;
                this.setFrogPos();
            }
            if (DataProl.isXinShou && !e.isAI) {
                if (webNetworkMananger.getInstance().gameSceneRec.prop_messageTimes == 12) {
                    if (e.x >= GlobalData.GameStage_width * DataProl.gameSceneScal / 3 * 2 + 80) {
                        webNetworkMananger.getInstance().gameSceneRec.set_player_Point(GlobalData.GameStage_width * DataProl.gameSceneScal / 2 + 100, GlobalData.GameStage_height * DataProl.gameSceneScal / 2 + 100);
                        webNetworkMananger.getInstance().gameSceneRec.displayer_message(11, 700, 500);
                        AIServer.getInstance().deleteLineFrog(3, null);
                    }
                }
            }
        };
        /**判断击杀 */
        frog.prototype.DetermineKill = function (killNumber) {
            //击杀
            if (this.killNum < killNumber) {
                //预留判断击杀眼镜
                if (!this.shipin1.visible) {
                    this.shipin1.visible = true;
                    this.eyetimeMojing = Date.now();
                }
                //显示击杀特效
                if (this.userid == DataProl.account) {
                    if (this.isInRange == true) {
                        webNetworkMananger.getInstance().gameSceneRec.disPlayKillMan(killNumber);
                    }
                }
            }
            this.killNum = killNumber;
        };
        /**添加帧动画到数组 */
        frog.prototype.addClip = function () {
            for (var i = 0; i < 9; i++) {
                var data = RES.getRes(ClipName[i] + "_json");
                var txtr = RES.getRes(ClipName[i] + "_png");
                var MovieClipFactory = new egret.MovieClipDataFactory(data, txtr);
                var Clip = new egret.MovieClip(MovieClipFactory.generateMovieClipData(ClipName[i]));
                Clip.name = ClipName[i];
                Clip.anchorOffsetX = Clip.width / 2;
                Clip.anchorOffsetY = Clip.height / 2;
                Clip.scaleX = 0.5;
                Clip.scaleY = 0.5;
                this.Clip_shuzu.push(Clip);
            }
        };
        /**播放帧动画 */
        frog.prototype.MovieClipPlay = function (type) {
            var _this = this;
            this.Clip_shuzu[type].visible = true;
            if (!DataProl.isXinShou) {
                if (!this.isInRange)
                    return;
            }
            if (this.isInRange == true) {
                if (this.Clip_shuzu[type].name == "xuanyun") {
                    //设置眩晕时旋转的星星在青蛙头顶
                    this.Clip_shuzu[type].anchorOffsetX = this.shipin1.width / 2;
                    this.Clip_shuzu[type].anchorOffsetY = this.shipin1.height / 2;
                    this.Clip_shuzu[type].x = -3;
                    this.Clip_shuzu[type].y = -50;
                    this.addChild(this.Clip_shuzu[type]);
                    if (this.xuanyunTime == 0) {
                        this.xuanyunTime = 1;
                        if (DataProl.isXinShou) {
                            webNetworkMananger.getInstance().gameSceneRec.displayer_message(12, 700, 500);
                        }
                        this.Clip_shuzu[type].play(1);
                    }
                    else {
                        this.Clip_shuzu[type].play(2);
                    }
                    this.Clip_CallBack(type, 1000);
                    return;
                }
                if (this.Clip_shuzu[type].name == "drink") {
                    this.Clip_shuzu[type].scaleX = this.Clip_shuzu[type].scaleY = 0.8;
                    this.Clip_shuzu[type].anchorOffsetX = this.shipin1.width / 2;
                    this.Clip_shuzu[type].anchorOffsetY = this.shipin1.height / 2;
                    this.Clip_shuzu[type].x = 10;
                    this.Clip_shuzu[type].y = -100;
                    this.addChild(this.Clip_shuzu[type]);
                    if (this.isInRange == true) {
                        FaceManager.GetInstance().ChangeDizzinessEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
                    }
                    this.Clip_shuzu[type].play(serverConfig.config.propBuffReationTime.drink / 1000 + 5);
                    this.Clip_CallBack(type, 1000);
                    return;
                }
                if (this.Clip_shuzu[type].name == "paopao") {
                    this.addChild(this.Clip_shuzu[type]);
                    //设定眩晕时副帧动画（第二个帧动画）的冒泡的位置从青蛙头顶开始
                    this.Clip_shuzu[type].x = -100;
                    this.Clip_shuzu[type].y = -150;
                    this.Clip_shuzu[type].play(serverConfig.config.propBuffReationTime.drink / 1000);
                    this.Clip_CallBack(type, 1000);
                    return;
                }
                if (this.Clip_shuzu[type].name == "bianse") {
                    this.Clip_shuzu[type].scaleX = this.Clip_shuzu[type].scaleY = 1;
                    this.ClipLayer.addChild(this.Clip_shuzu[type]);
                    if (this.bianseTime == 0) {
                        this.setClip(type, -45, -160, 1);
                        this.bianseTime = 1;
                    }
                    else {
                        this.setClip(type, -45, -160, 2);
                    }
                    this.Clip_CallBack(type, 1000);
                    //this.Clip_CallBack(type);
                    return;
                }
                if (this.Clip_shuzu[type].name == "ice") {
                    this.ClipLayer.addChild(this.Clip_shuzu[type]);
                    this.Clip_shuzu[type].scaleX = this.Clip_shuzu[type].scaleY = 0.8;
                    this.setClip(type, 10, -140, serverConfig.config.propBuffReationTime.ice / 1000);
                    this.ice_Play();
                    this.Clip_CallBack(type, serverConfig.config.propBuffReationTime.ice);
                    return;
                }
                if (this.Clip_shuzu[type].name == "jiandao") {
                    this.ClipLayer.addChild(this.Clip_shuzu[type]);
                    this.setClip(type, 10, -125, serverConfig.config.propBuffReationTime.cut / 1000);
                    this.Clip_CallBack(type, serverConfig.config.propBuffReationTime.cut);
                    return;
                }
                if (this.Clip_shuzu[type].name == "heart") {
                    this.ClipLayer.addChild(this.Clip_shuzu[type]);
                    this.setClip(type, 0, -85, 2);
                    if (DataProl.isXinShou && webNetworkMananger.getInstance().gameSceneRec.prop_messageTimes == 10) {
                        webNetworkMananger.getInstance().gameSceneRec.displayer_message(10, 900, 500);
                        webNetworkMananger.getInstance().gameSceneRec.lock_shoot();
                    }
                    else if (DataProl.isXinShou && webNetworkMananger.getInstance().gameSceneRec.prop_messageTimes == 12) {
                        webNetworkMananger.getInstance().gameSceneRec.lock_shoot();
                        webNetworkMananger.getInstance().gameSceneRec.unlockControl();
                        webNetworkMananger.getInstance().gameSceneRec.ControlMove(-10, 0); //通过程序控制摇杆，使玩家向右移动，撞向AI的舌网
                        setTimeout(function () {
                            webNetworkMananger.getInstance().gameSceneRec.unlockControl();
                            webNetworkMananger.getInstance().gameSceneRec.ControlMove(10, 0); //通过程序控制摇杆，使玩家向右移动，撞向AI的舌网
                        }, 500);
                    }
                    this.Clip_CallBack(type, 1000);
                    return;
                }
                if (this.Clip_shuzu[type].name == "miwu") {
                    this.Clip_shuzu[type].scaleX = this.Clip_shuzu[type].scaleY = 0.8;
                    //this.ClipLayer.addChild(this.Clip_shuzu[type]);
                    this.addChild(this.Clip_shuzu[type]);
                    this.Clip_shuzu[type].x = -40;
                    this.Clip_shuzu[type].y = -60;
                    if (this.miwuTime == 0) {
                        this.Clip_shuzu[type].play(1);
                        this.miwuTime = 1;
                    }
                    else {
                        this.Clip_shuzu[type].play(2);
                    }
                    this.Clip_CallBack(type, 1000);
                    return;
                }
                if (this.Clip_shuzu[type].name == "xinsui") {
                    this.addChild(this.Clip_shuzu[type]);
                    //设定眩晕时副帧动画（第二个帧动画）的冒泡的位置从青蛙头顶开始
                    this.Clip_shuzu[type].x = -30;
                    this.Clip_shuzu[type].y = -100;
                    this.Clip_shuzu[type].scaleX = this.Clip_shuzu[type].scaleY = 0.8;
                    if (this.xinsuiTime == 0) {
                        this.xinsuiTime = 1;
                        this.Clip_shuzu[type].play(1);
                    }
                    else {
                        this.Clip_shuzu[type].play(2);
                    }
                    this.Clip_CallBack(type, 1000);
                    this.eye_change1();
                    this.eye_change2();
                    egret.Tween.get(this.Clip_shuzu[type])
                        .to({ alpha: 1 }, 1000 + 10)
                        .call(function () {
                        _this.Clip_shuzu[type].visible = false;
                        _this.nowPropsType[8] = -1;
                    }, this);
                    return;
                }
            }
        };
        /** 冰冻效果2：青蛙身上出现冰块*/
        frog.prototype.ice_Play = function () {
            //this.ice2.texture = RES.getRes("ice_2_png");
            this.ice2.anchorOffsetX = this.ice2.width / 2;
            this.ice2.anchorOffsetY = this.ice2.height / 2;
            if (Math.floor(this.level / 10) == 1) {
                this.ice2.scaleX = this.ice2.scaleY = 0.8;
            }
            else if (Math.floor(this.level / 10) == 2) {
                this.ice2.scaleX = this.ice2.scaleY = 0.9;
            }
            else if (Math.floor(this.level / 10) == 3) {
                this.ice2.scaleX = this.ice2.scaleY = 1.1;
            }
            else {
                this.ice2.scaleX = this.ice2.scaleY = 1.2;
            }
            this.ice2.x = 0;
            this.ice2.y = -10;
            this.ice2.visible = true;
            //记录青蛙当前尺寸
            var w = this.width;
            var h = this.height;
            /**此处添加会导致青蛙长宽变化 因此记录青蛙长宽 更改回去 避免阴影出错 */
            this.addChild(this.ice2);
            this.ice2.alpha = 0;
            this.width = w;
            this.height = h;
            egret.Tween.get(this.ice2)
                .to({ alpha: 1 }, 1000)
                .to({ alpha: 1 }, serverConfig.config.propBuffReationTime.ice - 2000)
                .to({ alpha: 0 }, 1000);
            return;
        };
        /** 舔到异色青蛙眼睛两边变化*/
        frog.prototype.eye_change1 = function () {
            var _this = this;
            if (this.isInRange == true) {
                FaceManager.GetInstance().ChangeAwkardEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
                // var heixian: eui.Image = new eui.Image();
                // heixian.texture = RES.getRes("heixian_png");
                // this.heixian.anchorOffsetX = this.heixian.width / 2;
                // this.heixian.anchorOffsetY = this.heixian.height / 2;
                // var han: eui.Image = new eui.Image();
                // han.texture = RES.getRes("han_png");
                // this.han.anchorOffsetX = this.han.width / 2;
                // this.han.anchorOffsetY = this.han.height / 2;
                this.han.visible = true;
                this.heixian.visible = true;
            }
            if (Math.floor(this.level / 10) == 1) {
                this.heixian.x = 20;
                this.heixian.y = -45;
                this.han.x = -30;
                this.han.y = -40;
                this.heixian.scaleX = this.heixian.scaleY = 0.7;
                this.han.scaleX = this.han.scaleY = 0.2;
            }
            else if (Math.floor(this.level / 10) == 2) {
                this.heixian.x = 22;
                this.heixian.y = -45;
                this.han.x = -22;
                this.han.y = -40;
                this.heixian.scaleX = this.heixian.scaleY = 0.75;
                this.han.scaleX = this.han.scaleY = 0.25;
            }
            else if (Math.floor(this.level / 10) == 3) {
                this.heixian.x = 30;
                this.heixian.y = -45;
                this.han.x = -30;
                this.han.y = -40;
                this.heixian.scaleX = this.heixian.scaleY = 0.8;
                this.han.scaleX = this.han.scaleY = 0.3;
            }
            else {
                this.heixian.x = 40;
                this.heixian.y = -45;
                this.han.x = -30;
                this.han.y = -40;
                this.heixian.scaleX = this.heixian.scaleY = 0.85;
                this.han.scaleX = this.han.scaleY = 0.35;
            }
            this.han.x = -30;
            this.han.y = -40;
            this.addChild(this.heixian);
            this.addChild(this.han);
            this.han.alpha = 0;
            egret.Tween.get(this.heixian)
                .to({ alpha: 1 }, 50)
                .to({ y: this.heixian.y + 10 }, 950);
            egret.Tween.get(this.han)
                .to({ alpha: 1 }, 50)
                .to({ scaleX: this.han.scaleX + 0.8, scaleY: this.han.scaleY + 0.8 }, 100)
                .to({ scaleX: this.han.scaleX - 0.8, scaleY: this.han.scaleY - 0.8 }, 100)
                .to({ scaleX: this.han.scaleX + 0.8, scaleY: this.han.scaleY + 0.8 }, 100)
                .to({ scaleX: this.han.scaleX - 0.8, scaleY: this.han.scaleY - 0.8 }, 100)
                .to({ scaleX: this.han.scaleX + 0.8, scaleY: this.han.scaleY + 0.8 }, 100)
                .to({ scaleX: this.han.scaleX - 0.8, scaleY: this.han.scaleY - 0.8 }, 100)
                .to({ scaleX: this.han.scaleX + 0.8, scaleY: this.han.scaleY + 0.8 }, 100)
                .to({ scaleX: this.han.scaleX - 0.8, scaleY: this.han.scaleY - 0.8 }, 100)
                .to({ scaleX: this.han.scaleX + 0.8, scaleY: this.han.scaleY + 0.8 }, 100)
                .to({ alpha: 0 }, 60)
                .call(function () {
                _this.han.visible = false;
                _this.heixian.visible = false;
                FaceManager.GetInstance().ChangeNormalEyes(_this.frogAniamtionDis, _this.leftEye, _this.rightEye);
                egret.Tween.removeTweens(_this.han);
            }, this);
            return;
        };
        /** 舔到异色青蛙眼睛内变化*/
        frog.prototype.eye_change2 = function () {
            if (Math.floor(this.level / 10) == 1) {
                this.eyeLeft.scaleX = this.eyeLeft.scaleY = 0.33;
                this.eyeRight.scaleX = this.eyeRight.scaleY = 0.33;
                this.eyeLeft.x = -14;
                this.eyeRight.x = 13;
            }
            else if (Math.floor(this.level / 10) == 2) {
                this.eyeLeft.scaleX = this.eyeLeft.scaleY = 0.35;
                this.eyeRight.scaleX = this.eyeRight.scaleY = 0.35;
                this.eyeLeft.x = -10;
                this.eyeRight.x = 17;
            }
            else if (Math.floor(this.level / 10) == 3) {
                this.eyeLeft.scaleX = this.eyeLeft.scaleY = 0.38;
                this.eyeRight.scaleX = this.eyeRight.scaleY = 0.38;
                this.eyeLeft.x = -14;
                this.eyeRight.x = 19;
            }
            else {
                this.eyeLeft.scaleX = this.eyeLeft.scaleY = 0.4;
                this.eyeRight.scaleX = this.eyeRight.scaleY = 0.4;
                this.eyeLeft.x = -14;
                this.eyeRight.x = 19;
            }
            this.eyeLeft.y = -33;
            this.eyeRight.y = -33;
            this.eyeLeft.visible = true;
            this.eyeRight.visible = true;
            this.addChild(this.eyeLeft);
            this.addChild(this.eyeRight);
            this.eye_Tween(this.eyeLeft);
            this.eye_Tween(this.eyeRight);
        };
        /**眼珠tween动画 */
        frog.prototype.eye_Tween = function (eye) {
            var _this = this;
            egret.Tween.get(eye)
                .to({ scaleX: 0, scaleY: 0 }, 300)
                .call(function () {
                eye.texture = _this.eyeLR.texture;
                eye.anchorOffsetX = eye.width / 2;
                eye.anchorOffsetY = eye.height / 2;
                eye.scaleX = 0.2;
                eye.scaleY = 1;
                egret.Tween.get(eye)
                    .to({ scaleX: 1 }, 200)
                    .to({ scaleX: 0.2 }, 200)
                    .to({ alpha: 1 }, 310)
                    .call(function () {
                    eye.visible = false;
                    egret.Tween.removeTweens(eye);
                }, _this);
                egret.Tween.removeTweens(eye);
            }, this);
        };
        /**帧动画回调的隐藏动画方法 */
        frog.prototype.Clip_CallBack = function (type, time) {
            var _this = this;
            egret.Tween.get(this.Clip_shuzu[type])
                .to({ alpha: 1 }, time + 10)
                .call(function () {
                _this.Clip_shuzu[type].visible = false;
                _this.nowPropsType[type + 1] = -1;
                //this.ClipLayer.removeChildren();//删除帧动画层所有子物体					
                if (type == 8 && DataProl.isXinShou) {
                    webNetworkMananger.getInstance().gameSceneRec.displayer_message(9, 900, 500);
                }
                egret.Tween.removeTweens(_this.Clip_shuzu[type]);
            }, this);
        };
        frog.prototype.setClip = function (type, x, y, num) {
            var _this = this;
            this.Clip_shuzu[type].play(num); //帧动画播放次数
            ///**固定动画播放位置在名字正上方，且方向固定 */
            var nameTimer = new egret.Timer(10, -1);
            nameTimer.addEventListener(egret.TimerEvent.TIMER, function (e) {
                _this.Clip_shuzu[type].x = _this.x + x;
                _this.Clip_shuzu[type].y = _this.y + y;
            }, this);
            nameTimer.start();
        };
        /**显示道具效果 */
        frog.prototype.displayEffectOfProps = function (propstates) {
            if (this.isInRange == true) {
                for (var i = 0; i < propstates.length; i++) {
                    var type = propstates[i].getPropType;
                    if (type <= 0) {
                        this.nowPropsType[type - 1] = type;
                        continue;
                    }
                    if (this.nowPropsType[type - 1] == type) {
                        continue;
                    }
                    if (type == 1) {
                        this.effectOfProps = this.zhuangtai_1;
                        this.effectOfProps.anchorOffsetX = this.effectOfProps.width / 2;
                        this.effectOfProps.anchorOffsetY = this.effectOfProps.height / 2;
                        this.effectOfProps.scaleX = this.effectOfProps.scaleY = 0.5;
                        this.effectOfProps.visible = true;
                        this.alpha = 0.1;
                        this.nowPropsType[type - 1] = type;
                        //console.log("111111111              " + this.nowPropsType);
                        continue;
                    }
                    if (type == 6 || type == 7) {
                        continue;
                    }
                    if (type == 8) {
                        this.nowPropsType[type - 1] = type;
                        this.MovieClipPlay(type - 2); //帧动画播放方法
                        this.bowen();
                    }
                    if (type == 9) {
                        this.nowPropsType[type - 1] = type;
                        this.MovieClipPlay(type - 1); //帧动画播放方法
                    }
                    if (type == 3 || type == 2 || type == 5) {
                        this.MovieClipPlay(type - 2); //帧动画播放方法
                        if (type == 5) {
                            this.MovieClipPlay(7); //播放变色迷雾
                        }
                        this.nowPropsType[type - 1] = type;
                        //console.log("222222222222          " + this.nowPropsType);
                        //continue;
                    }
                    if (type == 4) {
                        this.MovieClipPlay(type - 2); //帧动画播放方法
                        this.MovieClipPlay(5);
                        this.nowPropsType[type - 1] = type;
                        //continue;
                    }
                }
            }
        };
        /**添加碰撞是左右两侧的波纹(bowen) */
        frog.prototype.bowen = function () {
            this.bwRight.x = 50;
            this.bwRight.y = 0;
            this.bwRight.visible = true;
            this.addChild(this.bwRight);
            this.bwLeft.skewY = 180;
            this.bwLeft.x = -50;
            this.bwLeft.y = 0;
            this.bwLeft.visible = true;
            this.addChild(this.bwLeft);
            this.zhenchan(this.bwRight, this.zhenchanTimeRight, 60, 50);
            this.zhenchan(this.bwLeft, this.zhenchanTimeLeft, -60, -50);
        };
        frog.prototype.zhenchan = function (picture, time, x1, x2) {
            egret.Tween.get(picture)
                .to({ x: x1 }, 50)
                .to({ x: x2 }, 50)
                .to({ x: x1 }, 50)
                .to({ x: x2 }, 50)
                .to({ alpha: 1 }, 5)
                .call(function (e) {
                // if (time < serverConfig.config.propBuffReationTime.dizzy / 100 - 1) {
                // 	time += 1;
                // 	this.zhenchan(picture, time, x1, x2)
                // } else {
                time = 0;
                picture.visible = false;
                // }
                egret.Tween.removeTweens(picture);
            });
        };
        /**伸舌 */
        frog.prototype.loll = function () {
            if (!this.tweenOver) {
                return;
            }
            egret.Tween.removeTweens(this);
            var tonguePoint = this.localToGlobal(this.tongue.x, this.tongue.y);
            var myPoint = this.parent.localToGlobal(this.x, this.y);
            var direction = tonguePoint.subtract(myPoint);
            //给服务器发送射击信息
            AIServer.getInstance().shoot(this.userid, direction);
        };
        /**伸舌动画 */
        frog.prototype.lollAnime = function (longTongue) {
            var length = longTongue == 0 ? this.frogLineLength : longTongue;
            var tongue = this.tongue;
            tongue.height = this.scaleX * this.tongueWide;
            tongue.y = this.scaleX * (0 - 40);
            tongue.visible = true;
            tongue.width = 0;
            egret.Tween.get(tongue).to({ width: length * frogConfig.independent_Long_tongue_coefficient }, 100)
                .to({ width: 0 }, 100)
                .call(function (e) {
                tongue.visible = false;
                egret.Tween.removeTweens(tongue);
            });
        };
        /**获取朝向坐标 */
        frog.prototype.getTowardCoordinates = function () {
            var front = this.localToGlobal(0, 50);
            var myPoint = this.parent.localToGlobal(this.x, this.y);
            var direction = front.subtract(myPoint);
            return direction;
        };
        /**反向弹出 */
        frog.prototype.ReversePop_up = function (point, isaccount) {
            if (isaccount === void 0) { isaccount = false; }
            var myOrientation = this.getTowardCoordinates();
            if (myOrientation != null && myOrientation != undefined) {
                myOrientation.setTo(myOrientation.x, myOrientation.y);
                myOrientation.normalize(100);
                var targePoint = myOrientation.add(new egret.Point(this.x, this.y));
                // egret.Tween.get(this).to({ x: targePoint.x, y: targePoint.y }, 200).call(e => {
                // 	//this.canMove = true 
                // });
                TweenLite.to(this, 0.5, { x: targePoint.x, y: targePoint.y, ease: Back.easeInOut });
            }
        };
        /**饰品设置 */
        frog.prototype.shipinInit = function () {
            this.shipin.texture = resManager.getInstance().getExpressionGroups(7);
            this.shipin.anchorOffsetX = this.shipin.width / 2;
            this.shipin.anchorOffsetY = this.shipin.height / 2;
            this.shipin.x = 0;
            this.shipin.y = -35;
            this.shipin.scaleX = 0.7;
            this.shipin.scaleY = 0.85;
            this.addChild(this.shipin);
            this.shipin.visible = false;
            //this.changeShipin("shipin_" + (Math.floor(Math.random()*5+1)));
        };
        /**击杀表情 */
        frog.prototype.jisha = function () {
            this.shipin1.texture = resManager.getInstance().getExpressionGroups(17);
            this.shipin1.anchorOffsetX = this.shipin1.width / 2;
            this.shipin1.anchorOffsetY = this.shipin1.height / 2;
            this.shipin1.x = 0;
            this.shipin1.y = -35;
            this.shipin1.scaleX = 0.7;
            this.shipin1.scaleY = 0.85;
            this.addChild(this.shipin1);
            this.shipin1.visible = false;
            //this.changeShipin("shipin_" + (Math.floor(Math.random()*5+1)));
        };
        /**改变饰品 */
        frog.prototype.changeShipin = function (shipintype) {
            switch (shipintype) {
                case "shipin_1":
                    this.shipin.texture = this.shipin_1.texture;
                    break;
                case "shipin_2":
                    this.shipin.texture = this.shipin_2.texture;
                    break;
                case "shipin_3":
                    this.shipin.texture = this.shipin_3.texture;
                    break;
                case "shipin_4":
                    this.shipin.texture = this.shipin_4.texture;
                    break;
                case "shipin_5":
                    this.shipin.texture = this.shipin_5.texture;
                    break;
            }
            //this.shipin.texture = RES.getRes(shipintype);
            this.shipin.visible = true;
        };
        /**显示护盾 */
        frog.prototype.displayShield = function () {
            this.shieldOuter.texture = resManager.getInstance().getExpressionGroups(15);
            this.shieldInside.texture = resManager.getInstance().getExpressionGroups(16);
            this.shieldOuter.anchorOffsetX = this.shieldOuter.width / 2;
            this.shieldOuter.anchorOffsetY = this.shieldOuter.height / 2;
            this.shieldInside.anchorOffsetX = this.shieldInside.width / 2;
            this.shieldInside.anchorOffsetY = this.shieldInside.height / 2;
            this.shieldOuter.x = this.shieldInside.x = 0;
            this.shieldOuter.y = this.shieldInside.y = -25;
            this.addChild(this.shieldOuter);
            this.addChild(this.shieldInside);
            this.displayOrHideShield(false);
            //this.tu.texture = RES.getRes("eye_1");
            this.tu.anchorOffsetX = this.tu.width / 2;
            this.tu.anchorOffsetY = this.tu.height / 2;
            this.tu.x = 0;
            this.tu.y = -35;
            this.addChild(this.tu);
            this.tu.visible = false;
        };
        /**显示或隐藏保护罩 */
        frog.prototype.displayOrHideShield = function (disOrHide) {
            this.shieldOuter.visible = this.shieldInside.visible = disOrHide;
            if (disOrHide) {
                egret.Tween.get(this.shieldInside).to({ rotation: (this.shieldInside.rotation + 4) }, 1000 / 60);
                this.killNum = 0;
            }
            else {
                egret.Tween.removeTweens(this.shieldInside);
            }
        };
        /**青蛙转向 */
        frog.prototype.frogVeer = function () {
            var angle = this.getFrogAngle(this.x, this.y, this.targetPoint.x, this.targetPoint.y);
            if (!isNaN(angle)) {
                var addtime = 0;
                if (angle > 160) {
                    addtime += angle / 90;
                }
                egret.Tween.get(this).to({ rotation: angle }, gameGlobal.global.frogRotateTime - addtime);
            }
        };
        /**重置影子青蛙的位置 */
        frog.prototype.OnresetShadowFogPoint = function (obj) {
            var shadowFrog = obj.m_frogMgr.findFrogById(DataProl.shadowFrogId);
            if (shadowFrog != null) {
                shadowFrog.x = obj.x;
                shadowFrog.y = obj.y;
                console.log("同步更改影子青蛙" + DataProl.shadowFrogId);
            }
        };
        /**青蛙动画初始化 */
        frog.prototype.frogAnimationInit = function () {
            this.removeChild(this.frogAniamtionDis);
            this.frogAniamtionDis.armature.dispose();
            this.frogAniamtionDis = null;
        };
        /**处理青蛙升级
         * @param playerData 玩家数据
         */
        frog.prototype.dealFrogUpgrade = function (playerData) {
            if (this.level == playerData.level) {
                return;
            }
            //升级播放升级特效
            if (this.level < playerData.level) {
                this.playUserUpgrade(this._texture, this._config, 0, 0);
            }
            //如果主要等级不同换龙骨
            if (Math.floor(this.level / 10) != Math.floor(playerData.level / 10)) {
                this.level = playerData.level;
                /**主要等级 */
                var mainLevel = Math.floor(this.level / 10);
                this.frogAnimationInit();
                this.frogAniamtionDis = meterAanimation.getInstance().GetDragonAnimation(mainLevel);
                this.addChild(this.frogAniamtionDis);
                this.setChildIndex(this.frogAniamtionDis, 0);
                //升级体积变化
                switch (mainLevel) {
                    case 1:
                        this.scaleX = this.scaleY = 1;
                        break;
                    case 2:
                        this.scaleX = this.scaleY = 1.3;
                        break;
                    case 3:
                        this.scaleX = this.scaleY = 1.7;
                        break;
                    case 4:
                        this.scaleX = this.scaleY = 2.2;
                        break;
                    default:
                        break;
                }
            }
            this.level = playerData.level;
            FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);
        };
        /**连线青蛙后置 */
        frog.prototype.setFrogPos = function () {
            this.frogAniamtionDis.y = this.frogIsHadLine ? 0 : 0;
            this.shieldOuter.y = this.shieldInside.y = this.frogAniamtionDis.y - 25;
        };
        /**设置下个目标点 */
        frog.prototype.setTargetPoint = function (point) {
            if (this.userid == DataProl.shadowFrogId) {
                this.targetPoint.x = this.x + point.x;
                this.targetPoint.y = this.y + point.y;
                return;
            }
            this.targetPoint.x = point.x;
            this.targetPoint.y = point.y;
            if (this.tweenOver) {
                this.frogMoveto();
            }
            this.SetFrogNamePoint();
        };
        /**换装 */
        frog.prototype.changeType = function () {
            //this.changeClothes.changeClothes(this.frogAniamtionDis, this.type, this.mainLevel, this.minLevel);
            FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);
        };
        /*判断*/
        frog.prototype.shadowFrogMoveto = function (target) {
            egret.Tween.removeTweens(this);
            this.curPoint.x = this.x;
            this.curPoint.y = this.y;
            // if (!this.frogIsHadLine) {
            // 	if (this.x == this.targetPoint.x && this.y == this.targetPoint.y) {
            // 		//console.log("玩家没有移动");
            // 		return;
            // 	}
            // }
            /**影子青蛙移动 */
            this.targetPoint.x = this.x + target.x;
            this.targetPoint.y = this.y + target.y;
            if (this.targetPoint.x > gameGlobal.global.gameWidth - 55) {
                console.log("bianjie1");
                this.targetPoint.x = gameGlobal.global.gameWidth - 55;
            }
            if (this.targetPoint.y > gameGlobal.global.gameHeight - 65) {
                this.targetPoint.y = gameGlobal.global.gameHeight - 65;
                console.log("bianjie2");
            }
            if (this.targetPoint.x < 50) {
                this.targetPoint.x = 50;
                console.log("bianjie3");
            }
            if (this.targetPoint.y < 60) {
                this.targetPoint.y = 60;
                console.log("bianjie4");
            }
            return;
        };
        /**青蛙移动 */
        frog.prototype.frogMoveto = function () {
            var now = egret.getTimer();
            var time = this.timeOnEnterFrame;
            var pass = now - time;
            this.timeOnEnterFrame = egret.getTimer();
            egret.Tween.removeTweens(this);
            var angle = this.getFrogAngle(this.x, this.y, this.targetPoint.x, this.targetPoint.y);
            if (!this.frogIsHadLine) {
                if (this.x == this.targetPoint.x && this.y == this.targetPoint.y) {
                    //console.log("玩家没有移动");
                    return;
                }
            }
            /**影子青蛙移动 */
            if (this.userid == DataProl.shadowFrogId) {
                this.x = this.targetPoint.x;
                this.y = this.targetPoint.y;
                return;
            }
            //egret.Tween.get(this).to({ x: this.targetPoint.x, y: this.targetPoint.y }, pass);
            TweenLite.to(this, 1 / 3600, { x: this.targetPoint.x, y: this.targetPoint.y });
            if (!isNaN(angle)) {
                var addtime = 0;
                if (angle > 160) {
                    addtime += angle / 90;
                }
                //egret.Tween.get(this).to({ rotation: angle }, gameGlobal.global.frogRotateTime - addtime);
                TweenLite.to(this, 1 / 3600, { rotation: angle });
                return;
            }
        };
        /**获取玩家需要旋转的角度 */
        frog.prototype.getFrogAngle = function (mx, my, targetx, targety) {
            var angle;
            var ligUserId = null;
            var point = null;
            if (this.frogIsHadLine) {
                ligUserId = this.getLineUserId();
                if (ligUserId != null)
                    point = this.getLineUserPoint(ligUserId);
                else
                    angle = Util.getInstance().getRotation({ x: mx, y: my }, { x: targetx, y: targety });
                if (point != null)
                    angle = Util.getInstance().getRotation({ x: mx, y: my }, { x: point.x, y: point.y });
                else
                    angle = Util.getInstance().getRotation({ x: mx, y: my }, { x: targetx, y: targety });
            }
            else {
                this.changeFaceEye(1, null); //00修改				
                angle = Util.getInstance().getRotation({ x: this.x, y: this.y }, { x: targetx, y: targety });
            }
            return angle;
        };
        /** 获取连线玩家Id */
        frog.prototype.getLineUserId = function () {
            return this.m_frogMgr.getLigatureUserId(this.userid);
        };
        /**获取连线玩家坐标 */
        frog.prototype.getLineUserPoint = function (ligaUserId) {
            var frog = this.m_frogMgr.findFrogById(ligaUserId);
            if (frog == null) {
                return null;
            }
            return { x: frog.x, y: frog.y };
        };
        /**青蛙重置 */
        frog.prototype.reset = function () {
            this.visible = this.isUsed = false;
            this.userid = -1;
            if (this.frogTrai)
                this.frogTrai.visible = false;
            this.x = 0;
            this.y = 0;
            this.targetPoint.x = this.targetPoint.y = 0;
            this.scaleX = this.scaleY = 1;
            this.tweenOver = true;
            this.displayOrHideShield(false);
            this.frogName.text = "";
            this.frogName.visible = false;
            this.ClipLayer.removeChildren(); //清除所有在ClipLayer层上的动画
            this.nowPropsType = [-1, -1, -1, -1, -1, -1, -1, -1, -1];
        };
        /**青蛙重置(新手引导) */
        frog.prototype.reset2 = function () {
            this.scaleX = this.scaleY = 1;
            this.tweenOver = true;
            this.displayOrHideShield(false);
            this.nowPropsType = [-1, -1, -1, -1, -1, -1, -1, -1, -1];
            for (var i = 0; i < 9; i++) {
                this.ClipLayer.addChild(this.Clip_shuzu[i]);
            }
            this.ClipLayer.removeChildren(); //清除所有在ClipLayer层上的动画F
        };
        //快要断线了
        /**改变青蛙眼睛表情 ,faceTppe=0为快断线的眼，=1是正常眼*/
        frog.prototype.changeFaceEye = function (faceTppe, linemax) {
            if (this.isInRange == true) {
                if (this.qineyer != faceTppe && this.qineyer != 4 && this.qineyer != 3) {
                    this.qineyer = faceTppe;
                    if (faceTppe == 0) {
                        if (this.eyetime == -1) {
                            FaceManager.GetInstance().ChangeWinkEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
                            //faceTppe = 0;							
                        }
                    }
                    else if (faceTppe == 1) {
                        if (this.eyetime == -1) {
                            FaceManager.GetInstance().ChangeNormalEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
                        }
                    }
                    else {
                        this.eyetime = Date.now();
                        FaceManager.GetInstance().ChangeHeartEyes(this.frogAniamtionDis, this.leftEye, this.rightEye);
                        faceTppe = 4;
                        if (faceTppe == 4) {
                            this.MovieClipPlay(4);
                        }
                    }
                }
            }
        };
        frog.prototype.born = function (userid, name, x, y, frogType, levle, dressup) {
            if (userid == DataProl.shadowFrogId) {
                this.alpha = 0.5;
            }
            this.frogAnimationInit();
            this.frogAniamtionDis = meterAanimation.getInstance().GetDragonAnimation(1);
            this.addChild(this.frogAniamtionDis);
            this.setChildIndex(this.frogAniamtionDis, 0);
            this.x = x;
            this.y = y;
            this.userid = userid;
            this.username = name;
            this.type = 0;
            this.level = 11;
            this.ClipLayer.removeChildren(); //清除所有在ClipLayer层上的动画
            this.nowPropsType = [-1, -1, -1, -1, -1, -1, -1, -1, -1];
            /**初始化时换装  防止颜色出错*/
            FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);
            if (dressup != null) {
                if (dressup.decorateId > 0) {
                    this.changeShipin("shipin_" + (dressup.decorateId - 1000));
                }
                if (dressup.trailingId > 0) {
                    this.frogTrailing(dressup.trailingId - 2000);
                }
            }
            // console.log("zhaungban   " + dressup.decorateId);
            // this.changeShipin("shipin_"+3);
            // this.frogTrailing(2);
            //this.setFrogName(this.userid.toString());
            this.setFrogName(this.username.toString());
            this.isInRange = true;
            this.visible = this.isUsed = true;
            if (this.frogTrai)
                this.frogTrai.visible = true;
            if (userid == DataProl.account && webNetworkMananger.getInstance().gameSceneRec) {
                webNetworkMananger.getInstance().gameSceneRec.myUser.userSprit = this;
                if (!DataProl.isXinShou) {
                    webNetworkMananger.getInstance().gameSceneRec.camera.setTarget(this);
                }
            }
            if (this.userid == DataProl.account) {
                this.OnresetShadowFogPoint(this);
            }
        };
        /**设置青蛙的名字 */
        frog.prototype.setFrogName = function (nameStr) {
            if (nameStr == null || this.frogName == null)
                return;
            this.frogName.visible = true;
            var DisLen = gameGlobal.global.frogShowNameLength;
            var name = nameStr.length > DisLen ? nameStr.substring(0, DisLen) : nameStr;
            this.frogName.text = name;
            this.frogName.width = 220;
            if (this.userid == DataProl.account)
                this.frogName.textColor = 0xe3fe03;
        };
        frog.prototype.getdistance = function (x, y) {
            return Math.sqrt(x * x + y * y);
        };
        /**初始化名字 */
        frog.prototype.displayFrogName = function () {
            this.frogName = new eui.Label();
            this.frogName.fontFamily = "Microsoft YaHei";
            this.frogName.width = 60;
            this.frogName.height = 40;
            this.frogName.anchorOffsetX = this.frogName.width / 2;
            this.frogName.anchorOffsetY = this.frogName.height / 2;
            this.effectOfProps.anchorOffsetX = this.effectOfProps.width / 2;
            this.effectOfProps.anchorOffsetY = this.effectOfProps.height / 2;
            this.effectOfProps.scaleX = this.effectOfProps.scaleY = 3;
            this.frogName.textAlign = egret.HorizontalAlign.CENTER;
            this.frogName.verticalAlign = egret.VerticalAlign.MIDDLE;
            this.gamePanleHandle.addChild(this.frogName);
            this.gamePanleHandle.addChild(this.effectOfProps);
            this.frogName.visible = false;
        };
        /**设置青蛙名字位置 */
        frog.prototype.SetFrogNamePoint = function () {
            this.frogName.x = this.x - 70;
            this.frogName.y = this.y - 90;
            this.effectOfProps.x = this.x + 10;
            this.effectOfProps.y = this.y - 120;
        };
        /**播放玩家死亡动画 */
        frog.prototype.frogDied = function () {
            if (this.isUsed == false)
                return;
            //重置青蛙状态
            AIServer.getInstance().resetUserStates(this.userid);
            FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);
            this.frogAniamtionDis.addEventListener(dragonBones.EventObject.LOOP_COMPLETE, function () {
                // if (this.userid == DataProl.account) {
                // 	webNetworkMananger.getInstance().gameSceneRec.userDied.disPlayerDiedPanl();
                // }
                // this.reset();
            }, this);
            if (this.userid == DataProl.account) {
                webNetworkMananger.getInstance().gameSceneRec.userDied.disPlayerDiedPanl();
            }
            // if (this.Clip2 != null) {
            // 	this.Clip2.visible = false;
            // }
            // if (this.Clip3 != null) {
            // 	this.Clip3.visible = false;
            // }
            this.reset();
            //this.reset();
        };
        // protected _texture1: egret.Texture;
        // protected _config1: any;
        // protected _texture2: egret.Texture;
        // protected _config2: any;
        /**
         * 播放玩家升级特效
         */
        frog.prototype.playUserUpgrade = function (_texture, _config, x, y) {
            if (!serverConfig.config.isParticleRun)
                return;
            // if (this._texture && this._config) {
            // 	var lizi = new particle.GravityParticleSystem(this._texture, this._config);
            // 	this.addChild(lizi);
            // 	lizi.start(1);
            // 	lizi.anchorOffsetX = lizi.width / 2;
            // 	lizi.anchorOffsetY = lizi.height / 2;
            // 	lizi.x = this.frogAniamtionDis.x;
            // 	lizi.y = this.frogAniamtionDis.y;
            // }
            if (_texture && _config) {
                var lizi = new particle.GravityParticleSystem(_texture, _config);
                this.addChild(lizi);
                //this.tralingLayer.addChild(lizi);
                lizi.start(2);
                lizi.anchorOffsetX = lizi.width / 2;
                lizi.anchorOffsetY = lizi.height / 2;
                lizi.x = this.frogAniamtionDis.x + x;
                lizi.y = this.frogAniamtionDis.y + y;
                // var nameTimer: egret.Timer = new egret.Timer(10, -1);
                // nameTimer.addEventListener(egret.TimerEvent.TIMER, e => {
                // 	lizi.x = this.x ;
                // 	lizi.y = this.y ;
                // }, this);
                // nameTimer.start();
                // var liziTimer: egret.Timer = new egret.Timer(100, -1);
                // liziTimer.addEventListener(egret.TimerEvent.TIMER, e => {
                // 	lizi.emitterX = this.x;
                // 	lizi.emitterY = this.y;
                // }, this);
                // liziTimer.start();
            }
        };
        // protected playUserUpgrade2(): void {
        // 	if (!serverConfig.config.isParticleRun)
        // 		return;
        // 	if (this._texture2 && this._config2) {
        // 		var lizi2 = new particle.GravityParticleSystem(this._texture, this._config);
        // 		this.addChild(lizi2);
        // 		lizi2.start(1);
        // 		lizi2.anchorOffsetX = lizi2.width / 2;
        // 		lizi2.anchorOffsetY = lizi2.height / 2;
        // 		lizi2.x = this.frogAniamtionDis.x;
        // 		lizi2.y = this.frogAniamtionDis.y;
        // 	}
        // }
        /**加载升级资源 */
        frog.prototype.loadRes = function () {
            this._texture = RES.getRes("LevelUp_png");
            this._config = RES.getRes("LevelUp_json");
            // this._texture1 = RES.getRes("LevelUp1_png");
            // this._config1 = RES.getRes("LevelUp1_json");
            // this._texture2 = RES.getRes("LevelUp2_png");
            // this._config2 = RES.getRes("LevelUp2_json");
        };
        /**
         * 青蛙拖尾
         */
        frog.prototype.frogTrailing = function (type) {
            var _this = this;
            if (!serverConfig.config.isParticleRun)
                return;
            var tuowei_Texture = RES.getRes("tuowei_" + type.toString());
            var tuowei_Config = RES.getRes("newTuowei_json");
            if (tuowei_Texture && tuowei_Config) {
                this.frogTrai = new particle.GravityParticleSystem(tuowei_Texture, tuowei_Config);
                this.tralingLayer.addChild(this.frogTrai);
                this.frogTrai.start();
                var liziTimer = new egret.Timer(100, -1);
                liziTimer.addEventListener(egret.TimerEvent.TIMER, function (e) {
                    _this.frogTrai.emitterX = _this.x;
                    _this.frogTrai.emitterY = _this.y;
                }, this);
                liziTimer.start();
            }
            if (!this.isUsed && this.frogTrai) {
                this.frogTrai.visible = false;
            }
        };
        frog.moveDirection = function (dir) {
            //计算角度、方向   Math.atan2根据两点坐标计算到的弧度  
            var angleSpeed = Math.atan2(dir.y, dir.x);
            //弧度转化为角度 角度= 弧度*180/π  
            var N = angleSpeed * 180 / Math.PI;
            return N;
        };
        /**AI弹开tween动画 */
        frog.prototype.flicktweenAI = function (point) {
            this.tweenOver = false;
            var sX = this.scaleX;
            var sY = this.scaleY;
            egret.Tween.get(this).to({ x: point.x, y: point.y }, 400).call(this.flickcallback, this);
        };
        /**弹开tween动画 */
        frog.prototype.flicktween = function (point) {
            this.tweenOver = false;
            AIServer.getInstance().setUserStates(this.userid, 2);
            this.rolelock();
            var sX = this.scaleX;
            var sY = this.scaleY;
            egret.Tween.get(this).to({ x: point.x, y: point.y }, 400).call(this.flickcallback, this);
        };
        frog.prototype.flickcallback = function (e) {
            //删除所有tween动画
            egret.Tween.removeTweens(this);
            //解锁摇杆
            this.unrolelock();
            this.tweenOver = true;
            AIServer.getInstance().resetUserStates(this.userid);
        };
        /**获取贝塞尔曲线终点*/
        frog.prototype.setPoint = function (pointoverX, pointoverY) {
            this.pointOver.x = pointoverX;
            this.pointOver.y = pointoverY;
        };
        Object.defineProperty(frog.prototype, "factor", {
            /**获取贝塞尔曲线控制点 */
            get: function () {
                return 0;
            },
            /**定位贝塞尔曲线控制点 */
            set: function (value) {
                this.x = (1 - value) * (1 - value) * this.x + 2 * value * (1 - value) * (this.x + this.pointOver.x) / 2 + value * value * (this.pointOver.x);
                this.y = (1 - value) * (1 - value) * this.y + 2 * value * (1 - value) * (this.y + this.pointOver.y) / 2 + value * value * (this.pointOver.y);
            },
            enumerable: true,
            configurable: true
        });
        /**青蛙舔到道具移动 */
        frog.prototype.lickProp = function (pointoverX, pointoverY) {
            //初始化阴影
            this.shadowinint();
            //设置阴影大小
            this.setShadow();
            //添加阴影到舞台
            this.addChildAt(this.shadow, 0);
            this.tweenOver = false;
            //曲线移动设置终点
            this.setPoint(pointoverX, pointoverY);
            var sX = this.scaleX;
            var sY = this.scaleY;
            var shadowX = this.shadow.scaleX;
            var shadowY = this.shadow.scaleY;
            egret.Tween.get(this.shadow).to({ scaleX: this.shadow.scaleX - 0.5, scaleY: this.shadow.scaleY - 0.5 }, 250).to({ scaleX: shadowX, scaleY: shadowY }, 250);
            egret.Tween.get(this).to({ scaleX: this.scaleX + 0.5, scaleY: this.scaleY + 0.5 }, 300).to({ scaleX: sX, scaleY: sY }, 300).call(this.callback, this);
            egret.Tween.get(this).to({ factor: 1 }, 2000);
            //锁定摇杆
            this.rolelock();
        };
        frog.prototype.callback = function (e) {
            //移动完毕后给假服务器发送当前位置
            var point = egret.Point.create(this.x, this.y);
            var data = {
                "target": point,
                "account": DataProl.account
            };
            AIServer.getInstance().ClientFly(data);
            //删除所有tween动画
            egret.Tween.removeTweens(this);
            //解锁摇杆
            this.unrolelock();
            this.tweenOver = true;
            /**删除阴影 */
            this.removeChild(this.shadow);
            //console.log(this.height,this.width)
            //console.log(this.anchorOffsetX,this.anchorOffsetY)
        };
        /**锁定摇杆 */
        frog.prototype.rolelock = function () {
            //获取当前游戏场景
            if (this.m_frogMgr.gameHandle != null && this.m_frogMgr.gameHandle != undefined) {
                var gamesence = this.m_frogMgr.gameHandle;
                //获取摇杆
                if (gamesence.yaogan != null) {
                    this.m_frogMgr.gameHandle.yaogan.lockControl();
                }
            }
        };
        /**解锁摇杆 */
        frog.prototype.unrolelock = function () {
            if (this.m_frogMgr.gameHandle != null && this.m_frogMgr.gameHandle != undefined) {
                var gamesence = this.m_frogMgr.gameHandle;
                if (gamesence.yaogan != null) {
                    this.m_frogMgr.gameHandle.yaogan.unlockControl();
                }
            }
        };
        return frog;
    }(eui.Component));
    control.frog = frog;
    __reflect(frog.prototype, "control.frog");
})(control || (control = {}));
var egretToWX = (function (_super) {
    __extends(egretToWX, _super);
    function egretToWX() {
        var _this = _super.call(this) || this;
        _this.closeBtn = new eui.Image();
        _this.isdisplay = false;
        return _this;
    }
    /**单例 */
    egretToWX.getInstance = function () {
        if (this.instance == null) {
            this.instance = new egretToWX();
        }
        return this.instance;
    };
    /**1 设置舞台*/
    egretToWX.prototype.setGameHandle = function (game) {
        this.gameHandle = game;
        console.log("stageWidth :" + this.gameHandle.stage.stageWidth + "   stageHeight:" + this.gameHandle.stage.stageHeight);
    };
    /**2 排行榜按钮绑定事件*/
    egretToWX.prototype.paihangBtnClick = function () {
        var _this = this;
        SoundManager.getInstance().playEffectSound("click_mp3");
        var openDataContext = wx.getOpenDataContext();
        if (this.isdisplay) {
            this.bitmap.parent && this.bitmap.parent.removeChild(this.bitmap);
            this.rankingListMask.parent && this.rankingListMask.parent.removeChild(this.rankingListMask);
            this.closeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.paihangBtnClick, this);
            this.closeBtn.parent.removeChild(this.closeBtn);
            this.isdisplay = false;
        }
        else {
            //处理遮罩，避免开放数据域事件影响主域。
            this.rankingListMask = new egret.Shape();
            this.rankingListMask.graphics.beginFill(0x000000, 1);
            this.rankingListMask.graphics.drawRect(0, 0, this.gameHandle.stage.width, this.gameHandle.stage.height);
            this.rankingListMask.graphics.endFill();
            this.rankingListMask.alpha = 0.5;
            this.rankingListMask.touchEnabled = true;
            this.gameHandle.addChild(this.rankingListMask);
            console.log("调取开放域");
            //简单实现，打开这关闭使用一个按钮。
            //this.gameHandle.addChild(this.gameHandle.paihang);
            //主要示例代码开始
            var bitmapdata_1 = new egret.BitmapData(window["sharedCanvas"]);
            bitmapdata_1.$deleteSource = false;
            var texture = new egret.Texture();
            texture._setBitmapData(bitmapdata_1);
            this.bitmap = new egret.Bitmap(texture);
            this.bitmap.width = this.gameHandle.stage.stageWidth;
            this.bitmap.height = this.gameHandle.stage.stageHeight;
            this.gameHandle.addChild(this.bitmap);
            this.closeBtn.texture = RES.getRes("guanbi");
            egret.setTimeout(function (e) {
                _this.gameHandle.addChild(_this.closeBtn);
            }, this, 500);
            this.closeBtn.x = this.gameHandle.stage.stageWidth - (this.gameHandle.stage.stageWidth - 840 * this.gameHandle.stage.stageHeight / 640) / 2 - this.closeBtn.width;
            this.closeBtn.y = (this.gameHandle.stage.stageHeight - 590 * this.gameHandle.stage.stageHeight / 640) / 2 + this.closeBtn.height / 2;
            this.closeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.paihangBtnClick, this);
            egret.startTick(function (timeStarmp) {
                egret.WebGLUtils.deleteWebGLTexture(bitmapdata_1.webGLTexture);
                bitmapdata_1.webGLTexture = null;
                return false;
            }, this);
            //主要示例代码结束    
            this.isdisplay = true;
        }
        //发送消息
        openDataContext.postMessage({
            isDisplay: this.isdisplay,
            text: 'hello',
            year: (new Date()).getFullYear()
        });
    };
    /**
     * 3 托管玩家的数据 完成一次游戏之后提交数据 只有提交过数据的玩家才被承认是玩过这个游戏的玩家
     * KVData参数 例：data=[{key:"score",value:"1234"},{key:"length",value:"1234"},{key:"kill",value:"1234"}]
     */
    egretToWX.prototype.storageUserData = function (KVData) {
        var object = {
            KVDataList: KVData,
            success: function (res) { console.log("托管数据成功 " + res); },
            fail: function (res) { console.log("托管数据失败 " + res.Msg); },
            complete: function (res) { console.log("完成数据托管操作"); }
        };
        wx.setUserCloudStorage(object);
    };
    /**
     * 4、根据keyList删除玩家托管的对应数据
     * keyListData参数 keyListData={["score","length","kill"]}
     */
    egretToWX.prototype.removeUserStorageData = function (keyListData) {
        var object = {
            keyList: keyListData,
            success: function (res) { console.log("删除托管数据成功 " + res); },
            fail: function (res) { console.log("删除托管数据失败 " + res.data); },
            complete: function (res) { console.log("完成删除数据操作"); }
        };
        wx.removeUserCloudStorage(object);
    };
    return egretToWX;
}(eui.Component));
__reflect(egretToWX.prototype, "egretToWX");
var DebugPlatform = (function () {
    function DebugPlatform() {
    }
    DebugPlatform.prototype.getUserInfo = function () {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                return [2 /*return*/, { nickName: "username" }];
            });
        });
    };
    DebugPlatform.prototype.login = function () {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                return [2 /*return*/];
            });
        });
    };
    DebugPlatform.prototype.onshareMessage = function () {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                return [2 /*return*/];
            });
        });
    };
    DebugPlatform.prototype.showShareMenu = function () {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                return [2 /*return*/];
            });
        });
    };
    DebugPlatform.prototype.activeShare = function (userid) {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                return [2 /*return*/];
            });
        });
    };
    DebugPlatform.prototype.getLaunchOptionsSync = function () {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                return [2 /*return*/];
            });
        });
    };
    return DebugPlatform;
}());
__reflect(DebugPlatform.prototype, "DebugPlatform", ["Platform"]);
if (!window.platform) {
    window.platform = new DebugPlatform();
}
//////////////////////////////////////////////////////////////////////////////////////
//
//  Copyright (c) 2014-present, Egret Technology.
//  All rights reserved.
//  Redistribution and use in source and binary forms, with or without
//  modification, are permitted provided that the following conditions are met:
//
//     * Redistributions of source code must retain the above copyright
//       notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above copyright
//       notice, this list of conditions and the following disclaimer in the
//       documentation and/or other materials provided with the distribution.
//     * Neither the name of the Egret nor the
//       names of its contributors may be used to endorse or promote products
//       derived from this software without specific prior written permission.
//
//  THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
//  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
//  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
//  IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
//  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
//  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
//  OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
//  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
//  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
//  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////////////
var ThemeAdapter = (function () {
    function ThemeAdapter() {
    }
    /**
     * 解析主题
     * @param url 待解析的主题url
     * @param onSuccess 解析完成回调函数，示例：compFunc(e:egret.Event):void;
     * @param onError 解析失败回调函数，示例：errorFunc():void;
     * @param thisObject 回调的this引用
     */
    ThemeAdapter.prototype.getTheme = function (url, onSuccess, onError, thisObject) {
        function onResGet(e) {
            onSuccess.call(thisObject, e);
        }
        function onResError(e) {
            if (e.resItem.url == url) {
                RES.removeEventListener(RES.ResourceEvent.ITEM_LOAD_ERROR, onResError, null);
                onError.call(thisObject);
            }
        }
        if (typeof generateEUI !== 'undefined') {
            egret.callLater(function () {
                onSuccess.call(thisObject, generateEUI);
            }, this);
        }
        else {
            RES.addEventListener(RES.ResourceEvent.ITEM_LOAD_ERROR, onResError, null);
            RES.getResByUrl(url, onResGet, this, RES.ResourceItem.TYPE_TEXT);
        }
    };
    return ThemeAdapter;
}());
__reflect(ThemeAdapter.prototype, "ThemeAdapter", ["eui.IThemeAdapter"]);
/**
 *
 * @author
 *
 */
var HttpCommand = (function () {
    function HttpCommand() {
        this.http_url = "http://api.fx1q.com/";
        this.http_key = "Vbu1WSodPL!4fNg3";
        this.http_head = "Accept:application/vnd.qq5.v1+json;charset=UTF-8";
    }
    HttpCommand.getInstance = function () {
        if (this.instance == null) {
            this.instance = new HttpCommand();
        }
        return this.instance;
    };
    HttpCommand.prototype.test = function () {
        var request = new egret.HttpRequest();
        request.responseType = egret.HttpResponseType.TEXT;
        var data = this.getString("");
        request.open("http://api.qq5.com/res/news", egret.HttpMethod.POST);
        request.setRequestHeader("Content-Type", this.http_head);
        request.send();
        request.addEventListener(egret.Event.COMPLETE, this.onGetComplete, this);
        request.addEventListener(egret.IOErrorEvent.IO_ERROR, this.onGetIOError, this);
        request.addEventListener(egret.ProgressEvent.PROGRESS, this.onGetProgress, this);
    };
    HttpCommand.prototype.onGetComplete = function (e) {
        console.log("postComplete" + e);
    };
    HttpCommand.prototype.onGetIOError = function (e) {
        var request = e.currentTarget.response;
        console.log("postError:" + e);
        console.log("postError:" + request.response);
        console.log("postError:" + e.data);
    };
    HttpCommand.prototype.onGetProgress = function (e) {
        console.log("postProgress" + e);
    };
    /**
    * qq5采用json数据
    */
    HttpCommand.prototype.getString = function (data) {
        var data64 = Base64Util.encode(data);
        var time = Math.floor(new Date().getTime() / 1000).toString();
        return "&data=" + data64 +
            "&time=" + time +
            "&sign=" + new md5().hex_md5(data64 + time + this.http_url) +
            "&device_type=" + "android" +
            "&version=" + "1.2.1";
    };
    return HttpCommand;
}());
__reflect(HttpCommand.prototype, "HttpCommand");
/**
 *
 * @author
 *
 */
var GlobalData = (function () {
    function GlobalData() {
    }
    /**改变分辨率 */
    GlobalData.changeDpi = function (obj) {
        obj.width = this.GameStage_width;
        obj.height = this.GameStage_height;
    };
    GlobalData.GameStage_width = 640;
    GlobalData.GameStage_height = 960;
    GlobalData.isweixin = 1;
    GlobalData.version = 201605241700;
    GlobalData.isGetShop = 0;
    //-------------------------------------------成就数据
    /**商品信息 */
    GlobalData.shopsData = null;
    /**用户商品信息 */
    GlobalData.userShopData = null;
    /**用户成就进度 */
    GlobalData.usrRecorData = null;
    /**成就达成目标 */
    GlobalData.attainmentTargets = null;
    return GlobalData;
}());
__reflect(GlobalData.prototype, "GlobalData");
/**
 *
 * @author
 *
 */
var StringConst = (function () {
    function StringConst() {
    }
    StringConst.String_00001 = "资源配置加载...";
    StringConst.String_00002 = "该功能暂未开放！";
    StringConst.String_00003 = "该功能暂未开放！";
    return StringConst;
}());
__reflect(StringConst.prototype, "StringConst");
/**
 *
 * @author
 *
 */
var UIConst = (function () {
    function UIConst() {
    }
    UIConst.POP_MESSAGE_TYPE_TIPS = 0;
    UIConst.POP_MESSAGE_TYPE_WINDOW = 1;
    UIConst.POP_MESSAGE_TYPE_WINDOW_CANCEL = 2;
    UIConst.POP_MESSAGE_TYPE_WINDOW_NOPOPAGAIN = 3;
    return UIConst;
}());
__reflect(UIConst.prototype, "UIConst");
/**
 *
 * @author
 *
 */
var DataManager = (function (_super) {
    __extends(DataManager, _super);
    function DataManager() {
        return _super.call(this) || this;
    }
    DataManager.getInstance = function () {
        if (this.instance == null) {
            this.instance = new DataManager();
        }
        return this.instance;
    };
    DataManager.prototype.initJsonData = function () {
        //RES.getResByUrl("Definfos_json",this.DefinfosCompelte,this,RES.ResourceItem.TYPE_JSON);
        //RES.getResByUrl("WallData_json",this.WallDataCompelte,this,RES.ResourceItem.TYPE_JSON);
    };
    DataManager.prototype.DefinfosCompelte = function (e) {
        this.enemy_arr = e;
    };
    DataManager.prototype.WallDataCompelte = function (e) {
        this.wall_arr = e;
    };
    return DataManager;
}(egret.EventDispatcher));
__reflect(DataManager.prototype, "DataManager");
/**
 * 动态缩放
 */
var dynamicScaling = (function () {
    function dynamicScaling() {
    }
    dynamicScaling.setScale = function (width, heigth) {
        this._scalingLayer.width = width;
        this._scalingLayer.height = heigth;
        this._scalingLayer.anchorOffsetX = width / 2;
        this._scalingLayer.anchorOffsetY = heigth / 2;
    };
    /**
     * 添加一个对象到缩放层
     * //建议group
     */
    dynamicScaling.addScalingObject = function (obj) {
        this._scalingLayer.addChild(obj);
    };
    /**
     * 从缩放层删除一个对象
     */
    dynamicScaling.removeScalingObject = function (obj) {
        if (this._scalingLayer.getChildIndex(obj) >= 0)
            this._scalingLayer.removeChild(obj);
        else
            egret.log("无此对象" + obj.name);
    };
    Object.defineProperty(dynamicScaling, "scaleNum", {
        get: function () {
            return this.scale;
        },
        set: function (scale) {
            this.scale = scale;
            this.changeScale();
        },
        enumerable: true,
        configurable: true
    });
    /**
     * 改变尺寸
     * @param{scaleNum 大小}
     * @param{changeTimer 动画时间}
     * @param{changePos 锚点坐标{x,y}   无代表地图中心}
     */
    dynamicScaling.changeScale = function () {
        var user = webNetworkMananger.getInstance().gameSceneRec.User;
        user = webNetworkMananger.getInstance().gameSceneRec.localToGlobal(user.x, user.y);
        this._scalingLayer.x = this._scalingLayer.anchorOffsetX = user.x;
        this._scalingLayer.y = this._scalingLayer.anchorOffsetY = user.y;
        egret.Tween.removeTweens(this._scalingLayer);
        egret.Tween.get(this._scalingLayer)
            .to({ scaleX: this.scale, scaleY: this.scale }, 500);
    };
    Object.defineProperty(dynamicScaling, "dynamicLayer", {
        get: function () {
            return this._scalingLayer;
        },
        enumerable: true,
        configurable: true
    });
    /**缩放层 */
    dynamicScaling._scalingLayer = new eui.Group();
    dynamicScaling.scale = 1;
    return dynamicScaling;
}());
__reflect(dynamicScaling.prototype, "dynamicScaling");
var DrawMap = (function () {
    function DrawMap() {
    }
    /**绘制六边形 */
    DrawMap.drawHexagonToGroup = function (group) {
        for (var t = 0; t < 1; t++) {
            for (var i = 0; i < 1; i++) {
                group.addChild(this.getHexagon(t, i));
            }
        }
    };
    /**绘制线 */
    DrawMap.drawLineToGroup = function (group) {
        var startX = -800;
        var startY = -800;
        var x = -500;
        var y = -500;
        var random = 0;
        while (x < 2500 * 3 / 2) {
            random = Math.floor(Math.random() * 200);
            group.addChild(this.getLine({ x: x + random, y: startY }, { x: x + random, y: 2500 * 3 / 2 }));
            x += random;
        }
        while (y < 2500 * 3 / 2) {
            random = Math.floor(Math.random() * 200);
            group.addChild(this.getLine({ x: startX, y: y + random }, { x: 2500 * 3 / 2, y: y + random }));
            y += random;
        }
    };
    DrawMap.getLine = function (startPoint, endPoint) {
        this.operationObject = new egret.Shape();
        this.operationObject.graphics.lineStyle(2, 0x00ff00);
        this.operationObject.graphics.moveTo(startPoint.x, startPoint.y);
        this.operationObject.graphics.lineTo(endPoint.x, endPoint.y);
        this.operationObject.graphics.endFill();
        return this.operationObject;
    };
    DrawMap.getHexagon = function (x, y) {
        this.operationObject = new eui.Image();
        this.operationObject.texture = RES.getRes("imageName");
        this.operationObject.width = 10;
        this.operationObject.height = 10;
        this.operationObject.anchorOffsetX = this.operationObject.width / 2;
        this.operationObject.anchorOffsetY = this.operationObject.height / 2;
        this.operationObject.x = x;
        this.operationObject.y = y;
        return this.operationObject;
    };
    DrawMap.operationObject = null;
    return DrawMap;
}());
__reflect(DrawMap.prototype, "DrawMap");
var MiniNet = (function () {
    function MiniNet() {
    }
    MiniNet.getInstance = function () {
        if (this.instance == null) {
            this.instance = new MiniNet();
        }
        return this.instance;
    };
    MiniNet.get = function (address, content, onGetComplete, onGetIOError, onGetProgress) {
        var request = new egret.HttpRequest();
        request.responseType = egret.HttpResponseType.TEXT;
        request.open(address, egret.HttpMethod.GET);
        request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        request.send();
        request.addEventListener(egret.Event.COMPLETE, onGetComplete, content);
        if (onGetIOError !== undefined)
            request.addEventListener(egret.IOErrorEvent.IO_ERROR, onGetIOError, content);
        if (onGetProgress !== undefined)
            request.addEventListener(egret.ProgressEvent.PROGRESS, onGetProgress, content);
    };
    MiniNet.post = function (_root_url, address, params, content, onGetComplete, onGetIOError, onGetProgress) {
        //_root_url = 'http://127.0.0.1:9100';
        var request = new egret.HttpRequest();
        request.responseType = egret.HttpResponseType.TEXT;
        request.open(_root_url + address, egret.HttpMethod.POST);
        request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        request.send(params);
        request.addEventListener(egret.Event.COMPLETE, onGetComplete, content);
        request.addEventListener(egret.IOErrorEvent.IO_ERROR, function () {
        }, content);
    };
    return MiniNet;
}());
__reflect(MiniNet.prototype, "MiniNet");
/**
 *
 * @author
 *
 */
var RoleManager = (function (_super) {
    __extends(RoleManager, _super);
    function RoleManager() {
        var _this = _super.call(this) || this;
        _this.attack = 30;
        return _this;
    }
    RoleManager.getInstance = function () {
        if (this.instance == null) {
            this.instance = new RoleManager();
        }
        return this.instance;
    };
    return RoleManager;
}(egret.EventDispatcher));
__reflect(RoleManager.prototype, "RoleManager");
var socketIONetMananger = (function () {
    function socketIONetMananger() {
        // private  _root_url: string="172.16.19.66";
        this._root_url = "172.16.19.59"; //"127.0.0.1";
        this._root_url_port = ":3011";
    }
    socketIONetMananger.getInstance = function () {
        if (this.instance == null) {
            this.instance = new socketIONetMananger();
        }
        return this.instance;
    };
    //CONCNET SERVER
    socketIONetMananger.prototype.connect = function () {
        if (this._root_url === null) {
            console.error("未设置连接HOST IP");
            return;
        }
        if (this.isConnecteed === true) {
            console.error("服务器已经连接");
            return;
        }
        this.socket = io.connect(this._root_url + this._root_url_port, { query: "type=" + "player" });
        this.receiveMessage();
    };
    // public sendMessage(type:string,msg:any):void {
    //     this.socket.emit(type, msg);
    // }
    socketIONetMananger.prototype.receiveMessage = function () {
        // this.socket.on('loginsucceed',function(data){
        //     LoginMain.LoginBackMess=data=="true"?0:1;
        // });
        // this.socket.on('news', function (data) { });
        // this.socket.on('playerJoin', function (data) { });
        // this.socket.on('gameSetup', function (data)
        // {
        //      var screenDate={
        //     "screenWidth":gameMap.getInstance().canvas_Width,
        //     "screenHeight":gameMap.getInstance().canvas_Height
        //      }
        //        StoryLogic.getInstance().openStory();
        //      //socketIONetMananger.getInstance().sendMessage('windowResized',JSON.stringify(screenDate));
        // });
        // this.socket.on('welcome', function (data)
        //  {
        //      var player={
        // 	    "name":gameGlobal.global.playerName,
        // 	     "id": gameMap.getInstance().player.id,
        //          "x":gameMap.getInstance().player.x,
        //          "y":gameMap.getInstance().player.y,
        // 	     "screenWidth":gameMap.getInstance().canvas_Width,
        //       	"screenHeight":gameMap.getInstance().canvas_Height,
        // 	    "target":gameMap.target
        //       }
        //    //socketIONetMananger.getInstance().sendMessage("",JSON.stringify(player));
        //  });
        // this.socket.on('serverTellPlayerMove', function (userData, foodsList, massList, virusList) 
        //  {
        //     gameGlobal.global.gameStart=true;
        //     gameGlobal.global.died=false;
        //     var useData={
        //        "userData":userData,
        //       // "foodsList":foodsList,
        //        "lineList":massList,
        //        //"virusList":virusList,
        //      };
        //     gameMap.getInstance().messageHandle(useData);}
        // );
        //  this.socket.on('RIP',function(){
        //    gameMap.getInstance().GameAgain();
        //    gameGlobal.global.gameStart=false;
        //    gameGlobal.global.died=true;
        //    gameGlobal.global.watingAgain=true;
        // });
    };
    socketIONetMananger.test = false;
    return socketIONetMananger;
}());
__reflect(socketIONetMananger.prototype, "socketIONetMananger");
/**
 *
 * @author
 *
 */
var SoundManager = (function () {
    function SoundManager() {
        this.bg_position = 0;
        this.isok = true;
        this.sound_switch = false;
        this.sound_effect_switch = true;
        this.scene = 0;
    }
    SoundManager.getInstance = function () {
        if (this.instance == null) {
            this.instance = new SoundManager();
        }
        return this.instance;
    };
    /**打开/关闭背景音乐*/
    SoundManager.prototype.playBgSound = function (b, str) {
        this.sound_switch = b;
        if (b) {
            // if (this.bgSound == null) {
            this.bgSound = RES.getRes(str);
            // }
            if (this.bgChannel != null) {
                this.bgChannel.stop();
                this.bgChannel = null;
            }
            this.bgChannel = this.bgSound.play(this.bg_position, 0);
        }
        else {
            if (this.bgChannel != null) {
                this.bg_position = this.bgChannel.position;
                this.bgChannel.stop();
                this.bgChannel = null;
            }
            else {
                this.bg_position = 0;
            }
        }
    };
    /**音效开关*/
    // public setSoundEffectSwitch(b:boolean):void
    // {
    //     this.sound_effect_switch = b;
    // }
    /**播放音效*/
    SoundManager.prototype.playEffectSound = function (str) {
        if (!this.sound_effect_switch) {
            return;
        }
        var sound = RES.getRes(str);
        if (sound != null) {
            var channel = sound.play(0, 1);
            var obj = { s: sound, c: channel };
            var complete = function () {
                this.c.stop();
                this.c = null;
                this.s = null;
            };
            channel.addEventListener(egret.Event.SOUND_COMPLETE, complete, obj);
        }
    };
    return SoundManager;
}());
__reflect(SoundManager.prototype, "SoundManager");
/**
 *
 * @author
 *
 */
var TweenManager = (function () {
    function TweenManager() {
        this.tween_ui_time = 500;
    }
    TweenManager.getInstance = function () {
        if (this.instance == null) {
            this.instance = new TweenManager();
        }
        return this.instance;
    };
    /**对ui进行缓动进入*/
    TweenManager.prototype.uiAppearTween = function (ui, type, extra, callback, thisObj) {
        //(storyUI,1,1,移除之前的UI的方法回调，UIManager)
        var tw = egret.Tween.get(ui);
        var w = GlobalData.GameStage_width;
        var h = GlobalData.GameStage_height;
        var xx = 0; //目标x
        var yy = 0; //目标y
        //先根据类型初始化状态 
        if (type == TweenManager.TWEEN_UI_MOVE) {
            ui.anchorOffsetX = w / 2;
            ui.anchorOffsetY = h / 2;
            if (extra == 0) {
                ui.x = w / 2;
                ui.y = h / 2;
            }
            else if (extra == 1) {
                ui.x = w / 2;
                ui.y = h / 2;
            }
            else if (extra == 2) {
                ui.x = w / 2;
                ui.y = h / 2;
            }
            else {
                ui.x = w / 2;
                ui.y = h / 2;
            }
            if (callback == null) {
                tw.to({ x: w / 2, y: h / 2 }, this.tween_ui_time);
            }
            else {
                tw.to({ x: w / 2, y: h / 2 }, this.tween_ui_time).call(callback, thisObj);
            }
        }
        else if (type == TweenManager.TWEEN_UI_SCALE) {
            if (extra == 0) {
                //中间坐标不用变
                ui.anchorOffsetX = w / 2;
                ui.anchorOffsetY = h / 2;
                ui.x = w / 2;
                ui.y = h / 2;
                xx = w / 2;
                yy = h / 2;
            }
            else if (extra == 1) {
                ui.anchorOffsetX = w;
                ui.anchorOffsetY = 0;
                ui.x = w * 2;
                ui.y = -h;
                xx = w;
                yy = 0;
            }
            else if (extra == 2) {
                ui.anchorOffsetX = w;
                ui.anchorOffsetY = h;
                ui.x = w * 2;
                ui.y = h * 2;
                xx = w;
                yy = h;
            }
            else if (extra == 3) {
                ui.anchorOffsetX = 0;
                ui.anchorOffsetY = h;
                ui.x = -w;
                ui.y = h * 2;
                xx = 0;
                yy = h;
            }
            else {
                ui.anchorOffsetX = 0;
                ui.anchorOffsetY = 0;
                ui.x = -w;
                ui.y = -h;
                xx = 0;
                yy = 0;
            }
            ui.scaleX = ui.scaleY = 0;
            if (callback == null) {
                tw.to({ x: xx, y: yy, scaleX: 1, scaleY: 1 }, this.tween_ui_time);
            }
            else {
                tw.to({ x: xx, y: yy, scaleX: 1, scaleY: 1 }, this.tween_ui_time).call(callback, thisObj);
            }
        }
        else if (type == TweenManager.TWEEN_UI_SCALE_ROTATION) {
            ui.alpha = 0;
            if (callback == null) {
                tw.to({ alpha: 1 }, this.tween_ui_time);
            }
            else {
                tw.to({ alpha: 1 }, this.tween_ui_time).call(callback, thisObj);
            }
        }
    };
    /**对一级UI的缓动退出*/
    TweenManager.prototype.uiDisappearTween = function (ui, type, extra, callback, thisObj) {
        var tw = egret.Tween.get(ui);
        var w = GlobalData.GameStage_width;
        var h = GlobalData.GameStage_height;
        var xx = 0;
        var yy = 0;
        //所有要移出前 先把瞄点和坐标重置一下
        if (type == TweenManager.TWEEN_UI_MOVE) {
            ui.anchorOffsetX = w / 2;
            ui.anchorOffsetY = h / 2;
            ui.x = w / 2;
            ui.y = h / 2;
            if (extra == 0) {
                xx = w * 3 / 2;
                yy = h / 2;
            }
            else if (extra == 1) {
                xx = w / 2;
                yy = h * 3 / 2;
            }
            else if (extra == 2) {
                xx = -w / 2;
                yy = h / 2;
            }
            else {
                xx = w / 2;
                yy = -h / 2;
            }
            if (callback == null) {
                tw.to({ x: xx, y: yy }, this.tween_ui_time);
            }
            else {
                tw.to({ x: xx, y: yy }, this.tween_ui_time).call(callback, thisObj);
            }
        }
        else if (type == TweenManager.TWEEN_UI_SCALE) {
            if (callback == null) {
                tw.to({ alpha: 0 }, this.tween_ui_time);
            }
            else {
                tw.to({ alpha: 0 }, this.tween_ui_time).call(callback, thisObj);
            }
        }
        else if (type == TweenManager.TWEEN_UI_SCALE_ROTATION) {
            if (extra == 0) {
                xx = w;
                yy = -h;
            }
            else if (extra == 1) {
                xx = w;
                yy = h;
            }
            else if (extra == 2) {
                xx = -w;
                yy = h;
            }
            else {
                xx = -w;
                yy = -h;
            }
            if (callback == null) {
                tw.to({ x: xx, y: yy, scaleX: 0.01, scaleY: 0.01, rotation: 720 }, this.tween_ui_time);
            }
            else {
                tw.to({ x: xx, y: yy, scaleX: 0.01, scaleY: 0.01, rotation: 720 }, this.tween_ui_time).call(callback, thisObj);
            }
        }
    };
    /**二级UI的缓动退出，与一级UId差别，方向相反。注意：callback不能为空，必须在callback内删除ui*/
    TweenManager.prototype.uiSecondDisappearTween = function (ui, type, extra, callback, thisObj) {
        var tw = egret.Tween.get(ui);
        var w = GlobalData.GameStage_width;
        var h = GlobalData.GameStage_height;
        var xx = 0;
        var yy = 0;
        //所有要移出前 先把瞄点和坐标重置一下
        if (type == TweenManager.TWEEN_UI_MOVE) {
            ui.anchorOffsetX = w / 2;
            ui.anchorOffsetY = h / 2;
            ui.x = w / 2;
            ui.y = h / 2;
            if (extra == 0) {
                xx = -w / 2;
                yy = h / 2;
            }
            else if (extra == 1) {
                xx = w / 2;
                yy = -h / 2;
            }
            else if (extra == 2) {
                xx = w * 3 / 2;
                yy = h / 2;
            }
            else {
                xx = w / 2;
                yy = h * 3 / 2;
            }
            if (callback == null) {
                tw.to({ x: xx, y: yy }, this.tween_ui_time);
            }
            else {
                tw.to({ x: xx, y: yy }, this.tween_ui_time).call(callback, thisObj);
            }
        }
        else if (type == TweenManager.TWEEN_UI_SCALE) {
            //由于进入的时候设置好了，退出时原路返回即可
            tw.to({ scaleX: 0, scaleY: 0 }, this.tween_ui_time).call(callback, thisObj);
        }
        else if (type == TweenManager.TWEEN_UI_SCALE_ROTATION) {
            if (extra == 0) {
                xx = w;
                yy = -h;
            }
            else if (extra == 1) {
                xx = w;
                yy = h;
            }
            else if (extra == 2) {
                xx = -w;
                yy = h;
            }
            else {
                xx = -w;
                yy = -h;
            }
            tw.to({ x: xx, y: yy, scaleX: 0.01, scaleY: 0.01, rotation: 720 }, this.tween_ui_time).call(callback, thisObj);
        }
    };
    /**随机取 非0的任意一种*/
    TweenManager.TWEEN_UI_RANDOM = -1;
    TweenManager.TWEEN_UI_NONE = 0;
    TweenManager.TWEEN_UI_MOVE = 1;
    TweenManager.TWEEN_UI_SCALE = 2;
    TweenManager.TWEEN_UI_SCALE_ROTATION = 3;
    return TweenManager;
}());
__reflect(TweenManager.prototype, "TweenManager");
var webNetworkMananger = (function () {
    function webNetworkMananger() {
        /**服务器移动 */
        this._root_url = "127.0.0.1";
    }
    webNetworkMananger.getInstance = function () {
        if (this.instance == null) {
            this.instance = new webNetworkMananger();
        }
        return this.instance;
    };
    webNetworkMananger.prototype.heartTimer = function () {
        // this.hertBeatTimer = new egret.Timer(1000, -1);
        // this.hertBeatTimer.addEventListener(egret.TimerEvent.TIMER, e => {
        // 	if (this.isConnecteed == true)
        // 		webNetworkMananger.getInstance().SendMeesage('hert', {});
        // }, this);
        // this.hertBeatTimer.start();
    };
    //CONCNET SERVER
    webNetworkMananger.prototype.connect = function () {
        if (this._root_url === null || DataProl.gameaddr_ip == null || DataProl.gameaddr_port
            == null) {
            console.error("未设置连接HOST IP");
            return;
        }
        // if (this.isConnecteed === true) {
        // 	console.error("服务器已经连接");
        // 	let m_AwesomeMessage = new awesomepackage.AwesomeMessage();
        // 	let m_c2sEnterRoom = new awesomepackage.c2sEnterRoom();
        // 	m_c2sEnterRoom.account = DataProl.account;
        // 	m_c2sEnterRoom.deessUp = JSON.stringify(DataProl.userCurrentDressUp);
        // 	m_AwesomeMessage.meesageId = 1002;
        // 	m_AwesomeMessage.data = awesomepackage.c2sEnterRoom.encode(m_c2sEnterRoom).finish();
        // 	var buffer = awesomepackage.AwesomeMessage.encode(m_AwesomeMessage).finish();
        // 	var byte2: egret.ByteArray = new egret.ByteArray(buffer);
        // 	webNetworkMananger.getInstance().SendBitMeesage(byte2);
        // 	return;
        // }
        this.webSocket = new egret.WebSocket();
        //设置数据格式为二进制，默认为字符串
        this.webSocket.type = egret.WebSocket.TYPE_BINARY;
        //添加收到数据侦听，收到数据会调用此方法
        this.webSocket.addEventListener(egret.ProgressEvent.SOCKET_DATA, this.onReceiveMessage, this);
        //添加链接打开侦听，连接成功会调用此方法
        this.webSocket.addEventListener(egret.Event.CONNECT, this.onSocketOpen, this);
        //添加链接关闭侦听，手动关闭或者服务器关闭连接会调用此方法
        this.webSocket.addEventListener(egret.Event.CLOSE, this.onSocketClose, this);
        //添加异常侦听，出现异常会调用此方法
        this.webSocket.addEventListener(egret.IOErrorEvent.IO_ERROR, this.onSocketError, this);
        //console.log("gameip" + DataProl.gameaddr_ip + ":" + DataProl.gameaddr_port);
        //连接服务器
        //DataProl.gameaddr_ip="172.16.19.163";
        //DataProl.gameaddr_ip="172.16.17.7";
        //DataProl.gameaddr_port = '3011';
        //	DataProl.gameaddr_ip = "127.0.0.1";
        //	console.log("serverip:" + DataProl.gameaddr_ip + "serverport:" + DataProl.gameaddr_port);
        //this.webSocket.connect('140.143.211.89', 3111);
        this.webSocket.connectByUrl('wss://meiruiya12.cn');
        //this.webSocket.connect('172.16.19.104', 3111);
        //his.webSocket.connect('132.232.205.216', 3014);
        //this.webSocket.connect('172.16.18.54', 3111);
        //	this.webSocket.connect(DataProl.gameaddr_ip, DataProl.gameaddr_port);
    };
    webNetworkMananger.prototype.onSocketOpen = function () {
        this.isConnecteed = true;
        //DataProl.login_main_handle.test_invite();
        LoginMain.LoginBackMess = 0;
        //	console.log("连接成功");
    };
    webNetworkMananger.prototype.onSocketClose = function () {
        this.isConnecteed = false;
        LoginMain.LoginBackMess = 1;
        //	console.log("连接失败");
    };
    webNetworkMananger.prototype.onSocketError = function () {
        //console.log("连接报错");
    };
    webNetworkMananger.prototype.SendBitMeesage = function (mes) {
        this.webSocket.writeBytes(mes);
        this.webSocket.flush();
    };
    //send message
    // public SendMeesage(type: string, mes: any): void {
    // 	var msg = {
    // 		"cmdName": type,
    // 		"data": mes
    // 	}
    // 	//	var deflate = new Zlib.Deflate("123");
    // 	// var compressed = deflate.compress();
    // 	// this.webSocket.writeUTF(JSON.stringify(msg));
    // 	// var byte: egret.ByteArray = new egret.ByteArray();
    // 	// //byte.writeUTF(JSON.stringify(msg));
    // 	// byte.writeUTF("1231");
    // 	// byte.position = 0;
    // 	// this.webSocket.writeBytes(byte, 0, byte.bytesAvailable);
    // 	// this.webSocket.flush();
    // 	// var byte: egret.ByteArray = new egret.ByteArray();
    // 	// var stt = JSON.stringify(msg);
    // 	// byte.writeUTFBytes(JSON.stringify(msg));
    // 	//  console.log("压缩前大小"+byte.length)
    // 	//  var tt = JSZip.compressions.DEFLATE.compress(	byte.bytes	, { level: 9 });;
    // 	//   console.log("压缩后大小"+tt.length);
    // 	//   	var byte2: egret.ByteArray = new egret.ByteArray(tt);
    // 	let ptest = new awesomepackage.AwesomeMessage();
    // 	//	ptest.awesomeField = "tt";
    // 	console.log(ptest);
    // 	var buffer = awesomepackage.AwesomeMessage.encode(ptest).finish();
    // 	var byte2: egret.ByteArray = new egret.ByteArray(buffer);
    // 	this.webSocket.writeBytes(byte2);
    // 	this.webSocket.flush();
    // }
    //recive message
    webNetworkMananger.prototype.onReceiveMessage = function (e) {
        var byte = new egret.ByteArray();
        this.webSocket.readBytes(byte);
        //	var msg = byte.readUTFBytes(byte.bytes);
        // var boo:boolean = byte.readBoolean();
        // var num:number = byte.readInt();
        //	var msg = this.webSocket.readUTF();
        //	this.reciveMessageHandle(JSON.parse(byte));
        //	var msg = this.webSocket.Bytes();
        //	var obj = JSON.parse(msg);
        //	var obj2 = JSON.parse(obj);
        this.reciveMessageHandle(byte.bytes);
    };
    //import { YIM, YIMErrorcode, getInstance, IEventObject, MessageBodyType, MessageVoiceType } from "yim";
    /**显示错误信息 */
    webNetworkMananger.prototype.showErrorMessage = function (data) {
        console.log(data);
        //this.gameSceneRec.displayErrorMessage(data);
    };
    webNetworkMananger.prototype.LoginGameServer = function () {
        var userinfo = weixinManager.getInstance().getUserInfo();
        var headUrl;
        var sex;
        if (userinfo != null && userinfo != undefined) {
            headUrl = weixinManager.getInstance().getUserInfo().avatarUrl;
            if (headUrl == null || headUrl == undefined) {
                headUrl = "text";
            }
            sex = weixinManager.getInstance().getUserInfo().gender;
            if (sex == null || sex == undefined) {
                sex = true;
            }
            else if (sex == 1) {
                sex = true;
            }
            else {
                sex = false;
            }
        }
        else {
            headUrl = "text";
            sex = true;
        }
        var m_AwesomeMessage = new awesomepackage.AwesomeMessage();
        var m_c2sLogin = new awesomepackage.c2sLogin();
        m_c2sLogin.account = DataProl.account;
        m_c2sLogin.sign = DataProl.sign;
        m_c2sLogin.nickname = gameGlobal.global.playerName;
        m_c2sLogin.headUrl = headUrl;
        m_c2sLogin.sex = sex;
        m_c2sLogin.deessUp = JSON.stringify(DataProl.userCurrentDressUp);
        m_AwesomeMessage.meesageId = 1001;
        m_AwesomeMessage.data = awesomepackage.c2sLogin.encode(m_c2sLogin).finish();
        var buffer = awesomepackage.AwesomeMessage.encode(m_AwesomeMessage).finish();
        // plain = Array.<number> or Uint8Array
        //var deflate = new Zlib.Deflate(buffer);
        //var compressed = deflate.compress();
        // // compressed = Array.<number> or Uint8Array
        // var inflate = new Zlib.Inflate(compressed);
        // var plain = inflate.decompress();
        var byte2 = new egret.ByteArray(buffer);
        // var pMessaage = awesomepackage.AwesomeMessage.decode(byte2);
        // var tmpMessage =awesomepackage.c2sLogin.decode(pMessaage.data);
        webNetworkMananger.getInstance().SendBitMeesage(byte2);
    };
    /**进入好友模式等待房间 */
    webNetworkMananger.prototype.intoFriendWaitRoom = function () {
        var m_AwesomeMessage = new awesomepackage.AwesomeMessage();
        var m_c2sEnterInvoteRoom = new awesomepackage.c2sEnterInvoteRoom();
        m_c2sEnterInvoteRoom.account = DataProl.account;
        DataProl.waitRoomId = DataProl.waitRoomId;
        //-----------------------------------测试好友模式直接输房间号
        m_c2sEnterInvoteRoom.waitRoomId = DataProl.waitRoomId;
        m_AwesomeMessage.meesageId = 2001;
        m_AwesomeMessage.data = awesomepackage.c2sEnterInvoteRoom.encode(m_c2sEnterInvoteRoom).finish();
        var buffer = awesomepackage.AwesomeMessage.encode(m_AwesomeMessage).finish();
        var byte2 = new egret.ByteArray(buffer);
        webNetworkMananger.getInstance().SendBitMeesage(byte2);
    };
    /**进入房间1002 */
    webNetworkMananger.prototype.intoRoom = function () {
        var m_AwesomeMessage = new awesomepackage.AwesomeMessage();
        var m_c2sEnterRoom = new awesomepackage.c2sEnterRoom();
        m_c2sEnterRoom.account = DataProl.account;
        m_c2sEnterRoom.waitRoomId = DataProl.waitRoomId;
        m_AwesomeMessage.meesageId = 1002;
        m_AwesomeMessage.data = awesomepackage.c2sEnterRoom.encode(m_c2sEnterRoom).finish();
        var buffer = awesomepackage.AwesomeMessage.encode(m_AwesomeMessage).finish();
        var byte2 = new egret.ByteArray(buffer);
        webNetworkMananger.getInstance().SendBitMeesage(byte2);
    };
    webNetworkMananger.prototype.reciveMessageHandle = function (backData) {
        var pMessaage = awesomepackage.AwesomeMessage.decode(backData);
        //console.log("接受消息:" + pMessaage.meesageId);
        //this.showSecondFrames(pMessaage.data.length);
        if (pMessaage.meesageId == 1000) {
            this.LoginGameServer();
        }
        //登陆成功
        if (pMessaage.meesageId == 1101) {
            DataProl.isEvenOnNet = true;
            if (DataProl.login_main_handle != null) {
                DataProl.login_main_handle.showNetMode();
                DataProl.login_main_handle.getLaunchInfo();
                //DataProl.login_main_handle.test_invite();
            }
        }
        if (pMessaage.meesageId == 1102) {
            var tmpMessage = awesomepackage.s2cEnterRoom.decode(pMessaage.data);
            var screenDate = {
                "screenWidth": 2500,
                "screenHeight": 2500,
            };
            if (tmpMessage.roomId == 0) {
                console.log("进入房间已满");
                DataProl.login_main_handle.show_reconnection_Main();
                return;
            }
            DataProl.roomid = tmpMessage.roomId;
            //	webNetworkMananger.getInstance().SendMeesage('windowResized', screenDate);
            DataProl.roomStartTime = 0;
            DataProl.roomTime = tmpMessage.roomStartTime;
            SceneManager.instance.SitchScene(SceneName.联网场景);
            if (this.gameSceneRec != null)
                this.gameSceneRec.playerPanel.showRoomId();
            if (DataProl.login_main_handle.invitationMain && DataProl.loginType != 0) {
                DataProl.login_main_handle.invitationMain.dissolvedRoom();
            }
            return;
        }
        if (pMessaage.meesageId == 1103) {
            if (this.miao == null) {
                this.miao = new Date().getSeconds();
                this.yimiaohowzhen = 0;
            }
            if (this.miao == new Date().getSeconds()) {
                this.yimiaohowzhen++;
            }
            else {
                this.miao = new Date().getSeconds();
                //console.log(this.yimiaohowzhen);
                DataProl.frameNumber = this.yimiaohowzhen;
                this.yimiaohowzhen = 0;
            }
            gameGlobal.global.gameStart = true;
            gameGlobal.global.died = false;
            var databuffer = new Zlib.Inflate(new Uint8Array(pMessaage.data));
            var bufferdata = databuffer.decompress();
            var transfromData = awesomepackage.s2cPlayerMove.decode(bufferdata); //this.transfromData(backData.data.userData);
            //		var userDataT=awesomepackage.roomPlayerInfo.decode(transfromData.userData);
            var translatedLineData = this.transfromLineData(transfromData.lineData);
            var useData = {
                "userData": transfromData.userData,
                "lineList": translatedLineData,
                "timeStamp": Date.now()
            };
            if (this.gameSceneRec != null) {
                this.gameSceneRec.handleInformationByServer(useData);
            }
            else {
                console.log("this.gameSceneRec==null");
            }
            return;
        }
        if (pMessaage.meesageId == 1106) {
            var tt = awesomepackage.s2cRespawn.decode(pMessaage.data);
            // if (tt.isRebirth == 0) {
            // 	webNetworkMananger.getInstance().gameSceneRec.isUserDied = false;
            // 	return;
            // }
            DataProl.roomStartTime = 0;
            DataProl.roomTime = tt.startRoomTime;
            if (this.gameSceneRec != null)
                this.gameSceneRec.playerPanel.startRoomTimer();
        }
        //处理排行榜信息
        if (pMessaage.meesageId == 1107) {
            var tl = awesomepackage.s2cTopList.decode(pMessaage.data);
            // if (this.gameSceneRec != null)
            // 	this.gameSceneRec.playerPanel.showNetTop(tl.tops, tl.min);
        }
        //游戏结束
        if (pMessaage.meesageId == 1108) {
            if (this.gameSceneRec != null) {
                var tgo = awesomepackage.s2cGameOver.decode(pMessaage.data);
                this.gameSceneRec.gameOverDis(tgo.roomUser);
            }
        }
        //处理道具
        if (pMessaage.meesageId == 1109) {
            var ttporp = awesomepackage.s2cAllPorp.decode(pMessaage.data);
            if (ttporp != null && ttporp != undefined) {
                DataProl.allPropData = ttporp.propData;
                //this.gameSceneRec.m_propMg.propsUpdata(ttporp.propData);
            }
        }
        //-------------------------------------------------------------好友模式
        //进入好友模式成功
        if (pMessaage.meesageId == 2101) {
            var tmpMessage = awesomepackage.s2cEnterInvoteRoomSuc.decode(pMessaage.data);
            DataProl.waitRoomId = tmpMessage.waitRoomId;
            console.log("房间号为" + DataProl.waitRoomId);
            switch (DataProl.waitRoomId) {
                case -1:
                    //房间已满
                    console.log("房间已满");
                    break;
                case -2:
                    //创建房间失败
                    console.log("创建房间失败");
                    break;
                case -3:
                    //获取信息失败
                    console.log("获取信息失败");
                    break;
                case -4:
                    //发送玩家信息失败
                    console.log("发送玩家信息失败");
                    break;
                default:
                    if (DataProl.login_main_handle) {
                        DataProl.login_main_handle.showFriendMain();
                        console.log("即将进入邀请好友模式");
                        var m_AwesomeMessage = new awesomepackage.AwesomeMessage();
                        var m_c2SInvoteRoomInfo = new awesomepackage.c2sEnterInvoteRoom();
                        m_c2SInvoteRoomInfo.account = DataProl.account;
                        m_c2SInvoteRoomInfo.waitRoomId = DataProl.waitRoomId;
                        m_AwesomeMessage.meesageId = 2002;
                        m_AwesomeMessage.data = awesomepackage.c2SInvoteRoomInfo.encode(m_c2SInvoteRoomInfo).finish();
                        var buffer = awesomepackage.AwesomeMessage.encode(m_AwesomeMessage).finish();
                        var byte2 = new egret.ByteArray(buffer);
                        webNetworkMananger.getInstance().SendBitMeesage(byte2);
                    }
                    break;
            }
        }
        //匹配成功，接受广播消息
        if (pMessaage.meesageId == 2102) {
            var tmpMessage = awesomepackage.s2cInvoteRoomInfo.decode(pMessaage.data);
            DataProl.waitRoomId = tmpMessage.waitRoomId;
            if (DataProl.login_main_handle) {
                /**如果只有自己的话 */
                if (tmpMessage.players.length == 1) {
                    DataProl.login_main_handle.invitationMain.clearUserMsg();
                    return;
                }
                else if (tmpMessage.players.length == 2) {
                    DataProl.login_main_handle.invitationMain.CanStartGame();
                }
                for (var i = 0; i < tmpMessage.players.length; i++) {
                    if (tmpMessage.players[i].nickname != gameGlobal.global.playerName) {
                        DataProl.login_main_handle.invitationMain.ShowMsg({
                            name: tmpMessage.players[i].nickname,
                            headUrl: tmpMessage.players[i].headUrl,
                            sex: tmpMessage.players[i].sex
                        });
                        return;
                    }
                }
            }
        }
        //退出房间成功
        if (pMessaage.meesageId == 2104) {
            var tmpMessage = awesomepackage.s2cRoomExit.decode(pMessaage.data);
            if (DataProl.login_main_handle) {
                DataProl.login_main_handle.invitationMain.dissolvedRoom(tmpMessage.result);
            }
        }
        //吐舌消息
        if (pMessaage.meesageId == 1130) {
            var tmpMessage = awesomepackage.s2cShoot.decode(pMessaage.data);
            this.gameSceneRec.dellPlayerShoot(tmpMessage);
        }
        //断线反作用力
        if (pMessaage.meesageId == 1131) {
            var tmpMessage = awesomepackage.s2cShoot.decode(pMessaage.data);
            this.gameSceneRec.disposeCounterforce(tmpMessage);
        }
        /**提示错误信息 */
        if (pMessaage.meesageId == 300) {
            var terr = awesomepackage.s2cErroMessage.decode(pMessaage.data);
            if (this.gameSceneRec != null)
                this.showErrorMessage(terr);
        }
        // if (backData.cmdName == "gameMapInit") {
        // 	if (this.gameSceneRec != null)
        // 		this.gameSceneRec.mapElementInit(backData.data);
        // }
    };
    /**显示每秒帧数 */
    webNetworkMananger.prototype.showSecondFrames = function (dataLong) {
        if (this.miao == null) {
            this.miao = new Date().getSeconds();
            this.dataLong = 0;
        }
        if (this.miao == new Date().getSeconds()) {
            this.dataLong += dataLong;
        }
        else {
            this.miao = new Date().getSeconds();
            //console.log("数据长度:" + this.dataLong);
            this.dataLong = 0;
        }
    };
    /**转换数据  /玩家/ */
    webNetworkMananger.prototype.transfromData = function (userData) {
        var data = [];
        for (var t = 0; t < userData.length; t++) {
            data.push(this.transfromUserData(userData[t]));
        }
        return data;
    };
    /**转换一个玩家的数据 */
    webNetworkMananger.prototype.transfromUserData = function (usss) {
        var currentPlayer = {
            name: usss.na,
            userId: usss.us,
            x: usss.x,
            y: usss.y,
            type: usss.ty,
            frogType: usss.fTy,
            level: usss.le,
            lineLength: usss.lLe,
            roomId: usss.rId,
            ishadLine: usss.isL,
            disconnection_line: false,
            disconnection_line_time: -1,
            propStates: usss.propStates,
            death: {
                isDeath: usss.dh.Dh,
                deadStartTime: usss.dh.dST
            },
            NewHandProtect: {
                isProtect: usss.NP.iP,
                ProtectStartTime: usss.NP.PST,
            },
            dressup: {
                decorateId: usss.dp.dI,
                trailingId: usss.dp.tI
            }
        };
        return currentPlayer;
    };
    /**转换线数据 */
    webNetworkMananger.prototype.transfromLineData = function (lineData) {
        var data = [];
        for (var t = 0; t < lineData.length; t++) {
            data.push(this.transfromLine(lineData[t]));
        }
        return data;
    };
    //转换单个线的数据
    webNetworkMananger.prototype.transfromLine = function (line) {
        var curLine = {
            uop: line.uO,
            utp: line.uT,
            userOneId: line.uOI,
            userTwoId: line.uTI,
            type: line.t
        };
        return curLine;
    };
    webNetworkMananger.test = false;
    webNetworkMananger.isServerMove = false;
    return webNetworkMananger;
}());
__reflect(webNetworkMananger.prototype, "webNetworkMananger");
var weixinManager = (function () {
    function weixinManager() {
    }
    weixinManager.getInstance = function () {
        if (this.instance == null) {
            this.instance = new weixinManager();
        }
        return this.instance;
    };
    /**获取微信授权拒绝后再允许调用 */
    weixinManager.prototype.tiao = function () {
        SceneManager.instance.SitchScene(SceneName.登录场景);
    };
    weixinManager.prototype.askAccredit = function (ongetOpenid, onGetComplete) {
        return __awaiter(this, void 0, void 0, function () {
            var res, userInfo;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, platform.login()];
                    case 1:
                        res = _a.sent();
                        return [4 /*yield*/, platform.getUserInfo(this.tiao)];
                    case 2:
                        userInfo = _a.sent();
                        if (userInfo == null) {
                            DataProl.huoqu = false;
                        }
                        else {
                            gameGlobal.global.playerName = userInfo.nickName;
                            DataProl.huoqu = true;
                        }
                        if (GlobalData.isweixin) {
                            this.setUserInfo(userInfo);
                            if (res != null)
                                this.setCode(res.code);
                            ongetOpenid(onGetComplete);
                        }
                        return [2 /*return*/];
                }
            });
        });
    };
    weixinManager.prototype.getUserInfo = function () {
        if (this.selfUserInfo == null) {
            console.log("未接受到微信信息");
        }
        return this.selfUserInfo;
    };
    weixinManager.prototype.setUserInfo = function (data) {
        this.selfUserInfo = data;
    };
    weixinManager.prototype.setCode = function (data) {
        this.code = data;
    };
    weixinManager.prototype.getCode = function () {
        if (this.code != null) {
            return this.code;
        }
    };
    //主动调起转发
    weixinManager.prototype.zhuDongShare = function (fn) {
        return __awaiter(this, void 0, void 0, function () {
            var res;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, platform.activeShare(0)];
                    case 1:
                        res = _a.sent();
                        //res = JSON.stringify(res);
                        console.log("转发之后结果：" + res.errMsg);
                        if (res.errMsg == "shareAppMessage:ok") {
                            console.log("转发成功");
                            //调用转发成功后的操作
                            fn();
                        }
                        return [2 /*return*/];
                }
            });
        });
    };
    /**分享 */
    weixinManager.prototype.clikShare = function () {
        this.zhuDongShare(function (e) {
            console.log("执行转发成功之后的操作");
        }).catch(function (e) {
            console.log("按钮绑定点击事件");
        });
    };
    return weixinManager;
}());
__reflect(weixinManager.prototype, "weixinManager");
/**
 * AI假服务器
 */
var AIServer = (function () {
    function AIServer() {
        this.c = serverConfig.config;
        this.p0Tmp = new egret.Point(0, 0);
        this.p1Tmp = new egret.Point(0, 0);
        /**玩家管理 */
        this.userMgr = AIUserMgr.getInstance();
        this.roomInfo = {
            gameOver: false,
            countDown: this.c.maxGameTime * 60,
            roomUser: [],
            roomLine: [],
            roomProps: [],
            AINumbers: 0,
            userNumbers: 0,
            opentime: 0,
            startTime: -1,
            roomId: -1
        };
        this.tmpShootPoint = new egret.Point();
        this.countPointP0tmp = new egret.Point(0, 0);
        this.countPointP1tmp = new egret.Point(0, 0);
        this.usrstarttmp = new egret.Point(0, 0);
        this.usrendtmp = new egret.Point(0, 0);
        this.usrendDirection = new egret.Point(0, 0);
        this.usrstartDirection = new egret.Point(0, 0);
        this.usrendPoint = new egret.Point(0, 0);
        this.usrstartPoint = new egret.Point(0, 0);
        this.circilePointTmp0 = new egret.Point(0, 0);
        this.circilePointTmp1 = new egret.Point(0, 0);
        /**记录移动间隔时间 */
        this.timeOnEnterFrame = 0;
        /**记录喝酒方向改变时间 */
        this.drunkennessFrame = 0;
        /**记录喝酒方向 */
        this.direction = 0;
        /**方向临时变量 */
        this.dir = new egret.Point();
        this.movePlayerTmpPoint = new egret.Point(0, 0);
        this.randomInRange = function (from, to) {
            return Math.floor(Math.random() * (to - from)) + from;
        };
        this.playpointTmp = new egret.Point(0, 0);
    }
    AIServer.getInstance = function () {
        if (this.instance == null) {
            this.instance = new AIServer();
        }
        return this.instance;
    };
    /**改变青蛙states状态 */
    AIServer.prototype.setUserStates = function (userid, type) {
        var player = this.userMgr.get(userid);
        if (player == null) {
            return;
        }
        player.states = type;
    };
    /**重置青蛙states状态 */
    AIServer.prototype.resetUserStates = function (userid) {
        var player = this.userMgr.get(userid);
        if (player == null) {
            return;
        }
        player.states = 0;
    };
    /**获取青蛙states状态 */
    AIServer.prototype.getUserStates = function (userid) {
        var player = this.userMgr.get(userid);
        if (player == null) {
            return;
        }
        return player.states;
    };
    /**发射出舌头 */
    AIServer.prototype.shoot = function (userid, dir) {
        var player = this.userMgr.get(userid);
        if (player == null) {
            return;
        }
        if (player.shootStates.isShoot == true) {
            console.log("玩家的已在射擊狀態...");
            return;
        }
        this.tmpShootPoint.setTo(dir.x, dir.y);
        this.tmpShootPoint.normalize(player.lineLength * frogConfig.independent_Long_tongue_coefficient);
        //  let vecdir = new Vector2(tmpMessage.targetx, tmpMessage.targety).normalize(player.speed);
        player.shootStates.isShoot = true;
        player.shootStates.point.y = Math.floor(player.y + this.tmpShootPoint.y);
        player.shootStates.point.x = Math.floor(player.x + this.tmpShootPoint.x);
    };
    /*判断一下是否有玩家被射中*/
    AIServer.prototype.checkShootPlayer = function (player) {
        if (player.shootStates.isShoot == false)
            return;
        var frog = webNetworkMananger.getInstance().gameSceneRec.m_createAllFrogs.findFrogById(player.userId);
        var minUserDistance = 10000;
        var minLineUser;
        var minprop;
        for (var i = 0; i < this.roomInfo.roomUser.length; ++i) {
            if ((Util.getInstance().isNull(this.roomInfo.roomUser[i].isAI) && this.roomInfo.roomUser[i].isAI) || this.roomInfo.roomUser[i].death.isDeath || this.isLineTogether(this.roomInfo.roomUser[i], player))
                continue;
            if (this.roomInfo.roomUser[i].userId == player.userId)
                continue;
            //找到舌头接触到所有玩家，找出其中最近的
            //  let nowDistance = this.checkIsOnALine(this.roomUser[i].lineLength, this.roomUser[i], player.shootStates.point);
            if (this.NewcheckIsOnALine(this.roomInfo.roomUser[i].lineLength, this.roomInfo.roomUser[i], player, player.shootStates.point)) {
                this.playpointTmp.setTo(player.x, player.y);
                var nowDistance = Util.getInstance().getDistance(this.roomInfo.roomUser[i], this.playpointTmp);
                if (nowDistance < minUserDistance) {
                    minUserDistance = nowDistance;
                    minLineUser = this.roomInfo.roomUser[i];
                    continue;
                }
            }
        }
        //找出舌头碰到的最近的道具
        for (var i = 0; i < this.roomInfo.roomProps.length; ++i) {
            if (this.roomInfo.roomProps[i].isisUsed)
                continue;
            if (this.NewcheckIsOnALine(50, this.roomInfo.roomProps[i], player, player.shootStates.point)) {
                this.playpointTmp.setTo(player.x, player.y);
                var nowDistance = Util.getInstance().getDistance(this.roomInfo.roomProps[i], this.playpointTmp);
                if (nowDistance < minUserDistance) {
                    minUserDistance = nowDistance;
                    minprop = this.roomInfo.roomProps[i];
                    continue;
                }
            }
        }
        if (minLineUser != null) {
            var distance = MathUtils.distance(player.x, player.y, minLineUser.x, minLineUser.y);
            if (minLineUser.ishadLine || minLineUser.frogType != player.frogType) {
                AIPropsMgr.getInstance().changeSinglePlayerState({ type: 9 }, player); //舔到异色青蛙
                //frog.lollAnime(distance);
                this.resetPlayerShoot(player);
                return;
            }
            else {
                var line = LineManager.getInstance().getOneLine(player.userId, minLineUser.userId);
                if (line == null) {
                    console.log("线已经满了");
                    return;
                }
                line.userOneId = player.userId;
                line.userTwoId = minLineUser.userId;
                line.isUsed = true;
                line.type = minLineUser.frogType;
                minLineUser.ishadLine = true;
                player.ishadLine = true;
                minLineUser.otherLineUser = line.userOneId;
                player.otherLineUser = line.userTwoId;
                this.roomInfo.roomLine.push(line);
                frog.lollAnime(distance);
                this.resetPlayerShoot(player);
                return;
            }
        }
        else {
            if (minprop == null) {
                frog.lollAnime(0);
            }
            this.resetPlayerShoot(player);
            // this.broadcastShootMessage(player.userId);
        }
        //如果舔到道具调用飞过去方法
        if (minprop != null) {
            if (player.isAI) {
                return;
            }
            if (webNetworkMananger.getInstance().gameSceneRec != null) {
                if (webNetworkMananger.getInstance().gameSceneRec.m_createAllFrogs != null) {
                    if (frog != null) {
                        var distance = MathUtils.distance(player.x, player.y, minprop.x, minprop.y);
                        frog.lollAnime(distance - 50);
                        frog.lickProp(minprop.x, minprop.y);
                        this.resetPlayerShoot(player);
                    }
                }
            }
        }
        else {
            this.resetPlayerShoot(player);
        }
    };
    AIServer.prototype.resetPlayerShoot = function (player) {
        player.shootStates.isShoot = false;
        player.shootStartTime = 0;
        player.shootStates.point.x = 0;
        player.shootStates.point.y = 0;
    };
    /**判断一下线已经链接 */
    AIServer.prototype.isLineTogether = function (p1, p2) {
        if (p1.otherLineUser != null) {
            if (p1.otherLineUser == p2.userId)
                return true;
            else
                return false;
        }
        else {
            return false;
        }
    };
    AIServer.prototype.NewcheckIsOnALine = function (userSize, something, usrend, usrstart) {
        /**点到线的距离 */
        var pointToLineLength = Util.getInstance().getPointToLineDistance(usrend, usrstart, something);
        var tlenght = 50;
        return pointToLineLength < tlenght ? true : false;
    };
    /**断掉玩家指定的线 */
    AIServer.prototype.breakLine = function (theUserid) {
        var roomUser = this.roomInfo.roomUser;
        var len = roomUser.length - 1;
        var tmpUser = null;
        for (var i = len; i >= 0; i--) {
            if (roomUser[i].userId == theUserid) {
                tmpUser = roomUser[i];
            }
        }
        if (tmpUser == null) {
            console.log("房间内没有该玩家");
            return;
        }
        if (tmpUser.death.isDeath == true) {
            console.log("玩家已经死了...");
            return;
        }
        var tmpline = LineManager.getInstance().getUserLine(this.roomInfo.roomLine, tmpUser);
        if (Util.getInstance().isNull(tmpline)) {
            console.log("玩家的綫不存在...");
            return;
        }
        var playtwo = null;
        for (var i = len; i >= 0; i--) {
            if (roomUser[i].userId == tmpUser.otherLineUser) {
                playtwo = roomUser[i];
            }
        }
        if (playtwo != null) {
            /**青蛙下个目标点 */
            var p0 = this.nextpoint(tmpUser);
            var p1 = this.nextpoint(playtwo);
            /**青蛙最大舌长 */
            var maxDistance = playtwo.lineLength + tmpUser.lineLength + 0.5;
            /**青蛙下个目标间距离 */
            var nowDistance = Util.getInstance().getPointDistance(p0, p1);
            /**判断青蛙下个目标点是否是向外移动 如果是则弹开 0.5为误差值 */
            if (nowDistance >= maxDistance) {
                if (playtwo.isAI) {
                    playtwo.targetdir.setTo(0, 0);
                }
                else {
                    playtwo.targetdir.x = 0;
                    playtwo.targetdir.y = 0;
                }
                if (tmpUser.isAI) {
                    tmpUser.targetdir.setTo(0, 0);
                }
                else {
                    tmpUser.targetdir.x = 0;
                    tmpUser.targetdir.y = 0;
                }
                this.countPoint(tmpUser, playtwo);
            }
            var userOneInfo = this.userMgr.get(tmpline.userOneId);
            var userTwoInfo = this.userMgr.get(tmpline.userTwoId);
            LineManager.getInstance().lineLongerMax(userOneInfo, userTwoInfo);
        }
        LineManager.getInstance().recoveryLine(tmpline, this.roomInfo.roomLine);
        return;
    };
    /**检测下个目标点 */
    AIServer.prototype.nextpoint = function (player) {
        var point = null;
        if (player.isAI) {
            //获取ai下个目标点位置
            point = MathUtils.calculateNextPointEx(player.x, player.y, player.targetdir.x, player.targetdir.y, player.speed, false);
        }
        else {
            /**获取玩家下个目标点位置 */
            if (player.targetdir == null) {
                return;
            }
            var target = {
                x: player.targetdir.x,
                y: player.targetdir.y
            };
            var dir = egret.Point.create(target.x, target.y);
            //判断玩家的射击
            dir.normalize(player.speed);
            var nextX = player.x + dir.x;
            var nextY = player.y + dir.y;
            point = new egret.Point(nextX, nextY);
        }
        return point;
    };
    /**断线弹开动画 */
    AIServer.prototype.countPoint = function (playone, playertwo) {
        this.countPointP0tmp.setTo(playone.x, playone.y);
        this.countPointP1tmp.setTo(playertwo.x, playertwo.y);
        var point1 = LineManager.getInstance().calulatePopDir1(this.countPointP0tmp, this.countPointP1tmp);
        var point2 = LineManager.getInstance().calulatePopDir1(this.countPointP1tmp, this.countPointP0tmp);
        LineManager.getInstance().frogchangepoint(playone, point1);
        LineManager.getInstance().frogchangepoint(playertwo, point2);
        LineManager.getInstance().getflicktween(point1, playone);
        LineManager.getInstance().getflicktween(point2, playertwo);
    };
    /**玩家移动 */
    AIServer.prototype.clientMove = function (data) {
        var point = data.target;
        AIUserMgr.getInstance().currentPlayer.targetdir = point;
    };
    AIServer.prototype.setGuidPoint = function (point) {
        AIUserMgr.getInstance().currentPlayer.target.x = point.x;
        AIUserMgr.getInstance().currentPlayer.target.y = point.y;
    };
    AIServer.prototype.ClientFly = function (data) {
        var point = data.target;
        var client = AIUserMgr.getInstance().currentPlayer;
        client.x = point.x;
        client.y = point.y;
        client.targetdir.x = point.x;
        client.targetdir.y = point.y;
    };
    AIServer.prototype.getRoomUsers = function () {
        return this.roomInfo.roomUser;
    };
    /**玩家变色 */
    AIServer.prototype.changeFrogType = function () {
        var player = AIUserMgr.getInstance().currentPlayer;
        if (player == null) {
            console.log("playerIsNo");
            return;
        }
        if (player.death.isDeath == true)
            return;
        player.frogType = player.frogType == this.c.maxtype ? 0 : player.frogType + 1;
    };
    /**房间初始化 */
    AIServer.prototype.roomInit = function () {
        LineManager.getInstance().createLines();
        this.userJoin();
        /**创建AI */
        if (DataProl.tuanduizhan) {
            serverAIMgr.getInstance().creatAIs(10);
        }
        else {
            serverAIMgr.getInstance().creatAIs(15);
            //serverAIMgr.getInstance().creatAIs(2);
        }
        this.createRoomsProps();
        var roomUser = AIUserMgr.getInstance().getAllUser();
        this.enterRoom(roomUser[DataProl.account]);
        this.gameStart();
    };
    /**退出房间初始化 */
    AIServer.prototype.roomRest = function () {
        LineManager.getInstance().restLines();
        AIUserMgr.getInstance().restUsers();
        serverAIMgr.getInstance().restAIs();
        AIPropsMgr.getInstance().restAllProps();
        this.roomInfo.gameOver = false;
        this.roomInfo.countDown = this.c.maxGameTime * 60;
    };
    /**玩家加入 */
    AIServer.prototype.userJoin = function () {
        var user = AIUserMgr.getInstance().get(DataProl.account);
        if (user == null) {
            AIUserMgr.getInstance().createPlayer(DataProl.account, DataProl.login_data.nickName);
        }
        else {
            AIUserMgr.getInstance().resetPlayer(user);
        }
    };
    /**房间道具初始化 */
    AIServer.prototype.createRoomsProps = function () {
        AIPropsMgr.getInstance().createProps();
        this.roomInfo.roomProps = AIPropsMgr.getInstance().roomPorpsInit();
        this.roomInfo.roomProps = AIPropsMgr.getInstance().getRoomProps();
        // console.log(this.roomInfo.roomProps);
    };
    ;
    /**玩家进入游戏*/
    AIServer.prototype.enterRoom = function (user) {
        if (user == null) {
            return 0;
        }
        var airoomInfo = this.roomInfo;
        if (airoomInfo == null) {
            console.log("房间不存在零");
            return 0;
        }
        if (airoomInfo.roomUser.length >= this.c.maxUserCountByRoom) {
            console.log("房间人数已满");
            return 0;
        }
        if (user.isAI) {
            airoomInfo.AINumbers++;
        }
        else {
            airoomInfo.userNumbers++;
        }
        AIUserMgr.getInstance().resetPlayer(user);
        airoomInfo.roomUser.push(user);
        var position = this.getRandomPostion();
        user.x = position.x;
        user.y = position.y;
        //设置一个保护罩
        this.userMgr.setProtectShiled(user);
        //modiftyUserAIbalance(airoomInfo);
    };
    ;
    // private isHaveUser(userId) {
    // 	var isHave = false;
    // 	this.roomInfo.roomUser.forEach(e => {
    // 		if (e.userId == userId)
    // 			isHave = true;
    // 	})
    // 	return isHave;
    // }
    /**游戏开始 */
    AIServer.prototype.gameStart = function () {
        this.roomInfo.gameOver = true;
        //	this.moveLoop.addEventListener(egret.TimerEvent.TIMER, this.updata, this);
        //	this.moveLoop.addEventListener(egret.TimerEvent.TIMER, this.gameLoops, this);
        this.lastTime = 0;
        //	this.moveLoop.start();
    };
    /**游戏结束 */
    AIServer.prototype.gameOver = function () {
        //	this.moveLoop.removeEventListener(egret.TimerEvent.TIMER, this.updata, this);
        //		this.moveLoop.removeEventListener(egret.TimerEvent.TIMER, this.gameLoops, this);
        //	this.moveLoop.reset();
        /*var user=this.userMgr.get(DataProl.account)
        this.userMgr.kickUser(user);*/
        this.roomRest();
    };
    AIServer.prototype.gameLoops = function () {
        //进行AI的排查
        //this.balancRoomAI();
        /**让AI加入房间 */
        if (DataProl.tuanduizhan) {
            this.roomAIInit(9);
        }
        if (DataProl.isXinShou) {
            return;
        }
        else {
            this.roomAIInit(this.c.clientMinUserCountByRoom);
        }
        //模拟AI的移动和消息
        if (!DataProl.isXinShou) {
            serverAIMgr.getInstance().AIUpdate();
        }
    };
    /**更新 */
    AIServer.prototype.updata = function () {
        if (!this.roomInfo.gameOver)
            return;
        /**房间内的线 */
        var roomLine = this.roomInfo.roomLine;
        /**房间内道具 */
        var roomProps = this.roomInfo.roomProps;
        /**房间内玩家 */
        //	var roomUser = this.roomInfo.roomUser;
        var len = this.roomInfo.roomUser.length - 1;
        //采用从后到前的方式，便于
        for (var i = len; i >= 0; i--) {
            var usss = this.roomInfo.roomUser[i];
            if (usss == null) {
                return;
            }
            if (usss.userId == DataProl.account) {
                this.moveActor(usss);
            }
            else {
                this.movePlayer(usss);
            }
            //usss.grade += 2;
            this.GetAttributesByGrade(usss);
        }
        //将未掉线的玩家进行线的判断
        //1.根据线来判断，两头的玩家距离是否超过，或者是否有玩家掉线，或者有玩家的类型不同
        //2.判断没有线的玩家是否会产生新的线
        //3.
        LineManager.getInstance().checklines(this.roomInfo.roomUser, this.roomInfo);
        //判断线是否碰到了道具
        //	var bornNumber = AIPropsMgr.getInstance().userPorpDied(this.roomInfo.roomLine, this.roomInfo.roomProps);
        var bornNumber = AIPropsMgr.getInstance().newUserPorpDied(this.roomInfo.roomUser, this.roomInfo.roomProps);
        //releaseAllDeadProps(rooms[keys[t]].roomLine);
        //判断线是否碰到其他玩家
        this.usersCheckDeatch(this.roomInfo.roomUser, this.roomInfo);
        //将所有的吃掉的道具从房间中去掉并且重生
        if (bornNumber != null && bornNumber > 0) {
            for (var V = 0; V < bornNumber; V++) {
                AIPropsMgr.getInstance().generateProp();
                roomProps = AIPropsMgr.getInstance().getRoomProps();
                //	console.log("重生道具的个数" + bornNumber);
            }
        }
        this.deleteExtraLine(roomLine);
        var movemsg = {
            "userData": this.roomInfo.roomUser,
            "lineList": roomLine,
            "foodsList": roomProps,
            "Virus": null,
            "topData": this.roomInfo.roomUser,
        };
        if (this.c.shi) {
            this.roomInfo.roomUser.forEach(function (u) {
                if (u != null) {
                    //is ai
                    if (u.userId == DataProl.account) {
                        AIServer.getInstance().filterTheInformation(u, movemsg);
                    }
                }
            });
        }
        webNetworkMananger.getInstance().gameSceneRec.handleInformationByServer(movemsg);
    };
    /**通过分数获取(舌长、舌宽、等级)属性
     * @param player 获取属性的对象
     */
    AIServer.prototype.GetAttributesByGrade = function (player) {
        var grade = player.grade;
        /**舌宽 */
        var tongueWideData = 0;
        /**线长 */
        var lineLength = 0;
        /**等级 */
        var rank = 0;
        if (parseInt(grade) >= 15000) {
            tongueWideData = 15;
            lineLength = 600;
            rank = 41;
        }
        else if (parseInt(grade) >= 9000) {
            tongueWideData = 13;
            lineLength = 500;
            rank = 36;
        }
        else if (parseInt(grade) >= 7800) {
            tongueWideData = 13;
            lineLength = 460;
            rank = 35;
        }
        else if (parseInt(grade) >= 6600) {
            tongueWideData = 12;
            lineLength = 420;
            rank = 34;
        }
        else if (parseInt(grade) >= 5600) {
            tongueWideData = 12;
            lineLength = 380;
            rank = 33;
        }
        else if (parseInt(grade) >= 4800) {
            tongueWideData = 11;
            lineLength = 350;
            rank = 32;
        }
        else if (parseInt(grade) >= 4000) {
            tongueWideData = 11;
            lineLength = 320;
            rank = 31;
        }
        else if (parseInt(grade) >= 3200) {
            tongueWideData = 10;
            lineLength = 280;
            rank = 26;
        }
        else if (parseInt(grade) >= 2600) {
            tongueWideData = 10;
            lineLength = 260;
            rank = 25;
        }
        else if (parseInt(grade) >= 2100) {
            tongueWideData = 9;
            lineLength = 240;
            rank = 24;
        }
        else if (parseInt(grade) >= 1700) {
            tongueWideData = 9;
            lineLength = 220;
            rank = 23;
        }
        else if (parseInt(grade) >= 1300) {
            tongueWideData = 8;
            lineLength = 200;
            rank = 22;
        }
        else if (parseInt(grade) >= 1000) {
            tongueWideData = 8;
            lineLength = 180;
            rank = 21;
        }
        else if (parseInt(grade) >= 700) {
            tongueWideData = 7;
            lineLength = 150;
            rank = 16;
        }
        else if (parseInt(grade) >= 550) {
            tongueWideData = 7;
            lineLength = 140;
            rank = 15;
        }
        else if (parseInt(grade) >= 400) {
            tongueWideData = 6;
            lineLength = 130;
            rank = 14;
        }
        else if (parseInt(grade) >= 250) {
            tongueWideData = 6;
            lineLength = 120;
            rank = 13;
        }
        else if (parseInt(grade) >= 100) {
            tongueWideData = 5;
            lineLength = 110;
            rank = 12;
        }
        else {
            tongueWideData = 5;
            lineLength = 100;
            rank = 11;
        }
        if (rank > 20) {
            if (Math.floor(player.level / 10) < Math.floor(rank / 10)) {
                player.size *= 1.3;
            }
        }
        player.level = rank;
        player.lineLength = lineLength * frogConfig.Long_tongue_coefficient;
        /**舌宽 */
        var tongueWide = tongueWideData * frogConfig.Tongue_width_coefficient;
    };
    AIServer.prototype.deleteExtraLine = function (roomLine) {
        for (var l = 0; l < roomLine.length;) {
            if (roomLine[l].userOneId == -1 || roomLine[l].userTwoId == -1) {
                roomLine.splice(l, 1);
            }
            else {
                l++;
            }
        }
    };
    AIServer.prototype.filterTheInformation = function (u, movemsg) {
        var rangeEye = this.c.rangeEye;
        var filterProps = movemsg.foodsList.map(function (f) {
            // console.log("1111"+ t);
            var t = MathUtils.distance(f.x, f.y, u.x, u.y);
            //  console.log("1111"+ t);
            if (MathUtils.distance(f.x, f.y, u.x, u.y) < rangeEye) {
                f.isInRange = true;
            }
            else {
                f.isInRange = false;
            }
            return f;
            // if (f.x > u.x - userScreenWidth / 2 - scopeOfTheFog &&
            // 	f.x < u.x + userScreenWidth / 2 + scopeOfTheFog &&
            // 	f.y > u.y - userScreenHeigth / 2 - scopeOfTheFog &&
            // 	f.y < u.y + userScreenHeigth / 2 + scopeOfTheFog) {
            // 	return f;
            // }
        }).filter(function (f) { return f; });
        var filterUser = movemsg.userData.map(function (f) {
            if (f.userId == u.userId) {
                f.isInRange = true;
                return f;
            }
            var t = MathUtils.distance(f.x, f.y, u.x, u.y);
            //	console.log("name" + f.name + "距离" + t);
            if (MathUtils.distance(f.x, f.y, u.x, u.y) > rangeEye) {
                //return f;
                f.isInRange = false;
            }
            else {
                f.isInRange = true;
            }
            return f;
            // if (f.x > u.x - userScreenWidth / 2 - scopeOfTheFog &&
            // 	f.x < u.x + userScreenWidth / 2 + scopeOfTheFog &&
            // 	f.y > u.y - userScreenHeigth / 2 - scopeOfTheFog &&
            // 	f.y < u.y + userScreenHeigth / 2 + scopeOfTheFog) {
            // 	return f;
            // }
        }).filter(function (f) { return f; });
        // var filterUser = movemsg.userData.map(
        // 	function (f) {
        // 		// console.log()
        // 		if (f.x > u.x - userScreenWidth / 2 - scopeOfTheFog &&
        // 			f.x < u.x + userScreenWidth / 2 + scopeOfTheFog &&
        // 			f.y > u.y - userScreenHeigth / 2 - scopeOfTheFog &&
        // 			f.y < u.y + userScreenHeigth / 2 + scopeOfTheFog) {
        // 			if (u.name == "Clb") {
        // 				console.log("123");
        // 			}
        // 			return f;
        // 		}
        // 	}
        // ).filter(function (f) { return f; });
        movemsg.foodsList = filterProps;
        movemsg.userData = filterUser;
    };
    AIServer.prototype.usersCheckDeatch = function (userListTmp, room) {
        for (var t = 0; t < userListTmp.length; t++) {
            this.userCheckDied(userListTmp[t], room);
        }
    };
    AIServer.prototype.getPorpStayTime = function (type) {
        var tmp = 10000;
        switch (type) {
            case 1:
                tmp = this.c.propBuffReationTime.hide;
                break;
            case 2:
                tmp = this.c.propBuffReationTime.ice;
                break;
            case 3:
                tmp = this.c.propBuffReationTime.cut;
                break;
            case 4:
                tmp = this.c.propBuffReationTime.drink;
                break;
            case 8:
                tmp = this.c.propBuffReationTime.dizzy;
                break;
            case 9:
                tmp = this.c.propBuffReationTime.dizzy;
                break;
        }
        return tmp;
    };
    /**玩家检测死亡*/
    AIServer.prototype.userCheckDied = function (tmpuser, room) {
        var user = this.userMgr.get(tmpuser.userId);
        if (user == null)
            return;
        if (user.death.isDeath)
            return;
        var timeNow = Date.now();
        if (user.death.isDeath)
            return;
        /**判断断线处罚是否结束 */
        if ((timeNow - user.disconnection_line_time > this.c.disconnection_line_time) && user.disconnection_line_time != -1) {
            user.disconnection_line = false;
            user.disconnection_line_time = -1;
            //console.log("name"+user.name+"处罚结束")
        }
        //判断玩家的BUFF是否到期，到期则取消
        for (var i = 0; i < user.propStates.length; i++) {
            if (user.propStates[i].getPropType > 0) {
                var diftime = 0;
                /**判断道具效果是否结束 */
                diftime = timeNow - user.propStates[i].PropStartTime;
                if (diftime > this.getPorpStayTime(user.propStates[i].getPropType)) {
                    user.propStates[i].getPropType = 0;
                    user.speed = this.c.initUserSpeed;
                    user.propStates[i].PropStartTime = 0;
                }
            }
        }
        //如果玩家处于保护状态，则不经过碰撞检测
        if (user.NewHandProtect.isProtect == true) {
            diftime = timeNow - user.NewHandProtect.ProtectStartTime;
            //console.log("新手时间" + Math.floor(diftime));
            if (diftime > this.c.newProtectTime) {
                //console.log("取消新手保护");
                user.NewHandProtect.isProtect = false;
                user.NewHandProtect.ProtectStartTime = 0;
            }
            else {
                return;
            }
        }
        if (user.propStates[1].getPropType == 2) {
            return;
        }
        if (DataProl.isXinShou && !user.isAI) {
            return;
        }
        var growline = Math.floor(user.lineLength * 0.05);
        /**遍历线下标列表 */
        for (var t = 0; t < room.roomLine.length; t++) {
            var oneLine = room.roomLine[t];
            if (oneLine.userOneId == user.userId || oneLine.userTwoId == user.userId) {
                continue;
            }
            var lineStartUserId = oneLine.userOneId;
            var lineEndUserId = oneLine.userTwoId;
            /**前端连线青蛙 */
            var usrstart = this.userMgr.get(lineStartUserId);
            if (usrstart == null) {
                //console.log("usrstart==null");
                continue;
            }
            /**尾端连线青蛙 */
            var usrend = this.userMgr.get(lineEndUserId);
            if (usrend == null) {
                //console.log("usrend==null");
                continue;
            }
            var userPoint = { x: user.x, y: user.y };
            /**是否是玩家自己的线*/
            if (user.id != lineStartUserId && user.id != lineEndUserId) {
                if (this.checkIsOnALine(userPoint, usrend, usrstart)) {
                    console.log("玩家:" + user.name + "  id" + user.id + "  已死亡");
                    if (user.propStates[2].getPropType == 3) {
                        //如果是剪刀直接回收线
                        LineManager.getInstance().recoveryLine(oneLine, this);
                        this.userMgr.resetPlayerOnePropStates(user, 2);
                        return;
                    }
                    //去除玩家身上存在的线
                    LineManager.getInstance().deleteLineFromPlayer(room, user);
                    if (usrstart.troops != user.troops || usrstart.troops == -1) {
                        usrend.grade += growline;
                        usrend.lineLength = AIPropsMgr.getInstance().GetAttributesByGrade(usrend.grade).frogLineLength;
                        usrend.level = AIPropsMgr.getInstance().GetAttributesByGrade(usrend.grade).level;
                        usrend.killNumber++;
                        usrstart.grade += growline;
                        usrstart.lineLength = AIPropsMgr.getInstance().GetAttributesByGrade(usrstart.grade).frogLineLength;
                        usrstart.level = AIPropsMgr.getInstance().GetAttributesByGrade(usrstart.grade).level;
                        usrstart.killNumber++;
                    }
                    if (usrend.userId == DataProl.account || usrstart.userId == DataProl.account) {
                        DataProl.totalLenght += growline;
                        //usrend.killNumber ++;
                        //usrstart.killNumber ++;
                        //console.log("测试总长度+:" + growline);
                    }
                    /**青蛙死亡调用创建荷叶 */
                    AIPropsMgr.getInstance().createLeaf(user.x, user.y, user.lineLength);
                    this.roomUserDied(user);
                }
            }
        }
    };
    AIServer.prototype.roomUserDied = function (player) {
        var _this = this;
        /**如果玩家身上有线 */
        player.death.isDeath = true;
        player.death.deadStartTime = Date.now();
        if (DataProl.isXinShou) {
            webNetworkMananger.getInstance().gameSceneRec.displayer_message(14, 700, 500);
            this.roomInfo.userNumbers--;
            return;
        }
        //AIUserMgr.getInstance().kickUser(player);
        if (player.isAI) {
            this.roomInfo.AINumbers--;
            console.log("重建青蛙" + player.name);
            setTimeout(function () {
                _this.respawnMessageManager(player.userId, player.name);
            }, 2000);
        }
        else {
            this.roomInfo.userNumbers--;
        }
        // this.respawnUser(player);
    };
    AIServer.prototype.myPointSub = function () {
    };
    AIServer.prototype.checkIsOnALine = function (something, usrend, usrstart) {
        this.usrstarttmp.setTo(usrstart.x, usrstart.y);
        this.usrendtmp.setTo(usrend.x, usrend.y);
        /**尾端玩家方向 */
        this.usrendDirection.setTo(this.usrstarttmp.x - this.usrendtmp.x, this.usrstarttmp.y - this.usrendtmp.y);
        /**前端玩家方向 */
        this.usrendDirection.setTo(this.usrendtmp.x - this.usrstarttmp.x, this.usrendtmp.y - this.usrstarttmp.y);
        //	let usrstartDirection = this.usrendtmp.subtract(this.usrstarttmp);
        this.usrstartDirection.normalize(usrstart.size);
        this.usrendDirection.normalize(usrend.size);
        this.usrendPoint.setTo(this.usrendtmp.x + this.usrendDirection.x, this.usrendtmp.y + this.usrendDirection.y);
        /**尾端舌头点 */
        //	let usrendPoint = this.usrendtmp.add(this.usrendDirection);
        /**前端舌头点 */
        //	let usrstartPoint = this.usrstarttmp.add(this.usrstartDirection);
        this.usrstartPoint.setTo(this.usrstarttmp.x + this.usrendDirection.x, this.usrstarttmp.y + this.usrendDirection.y);
        /**点到线的距离 */
        var pointToLineLength = AIPropsMgr.getInstance().getPointToLineDistance(this.usrendPoint, this.usrstartPoint, something);
        return pointToLineLength < 50 ? true : false;
    };
    AIServer.prototype.findIndexEx = function (arr, userId) {
        var len = arr.length;
        while (len--) {
            if (arr[len].userId === userId) {
                return len;
            }
        }
        return -1;
    };
    ;
    /**圆周运动 */
    AIServer.prototype.circlingMotion = function (player) {
        if (player.ishadLine && player.otherLineUser != -1 && player != null) {
            /**连线者 */
            var peer = AIUserMgr.getInstance().get(player.otherLineUser);
            if (peer == null) {
                return;
            }
            /**两者之间距离 */
            var distance = MathUtils.distance(player.x, player.y, peer.x, peer.y);
            /**最大线长 */
            var lineMax = player.lineLength + peer.lineLength;
            if (distance > lineMax) {
                this.circilePointTmp0.setTo(peer.x, peer.y);
                this.circilePointTmp1.setTo(player.x, player.y);
                var rotation = Util.getInstance().calculateRotation(this.circilePointTmp0, this.circilePointTmp1);
                //	var rotation = MathUtils.getAngleEx(peer.x, peer.y, player.x, player.y);
                var hudu = rotation * Math.PI / 180;
                player.x = peer.x + Math.sin(hudu) * (lineMax);
                player.y = peer.y - Math.cos(hudu) * (lineMax);
            }
        }
    };
    /**新手引导设置青蛙位置 */
    AIServer.prototype.setPlayer = function (x, y) {
        var player = AIUserMgr.getInstance().get(DataProl.account);
        if (player == null || player == undefined) {
            return;
        }
        if (!player.isAI && DataProl.isXinShou) {
            player.x = x;
            player.y = y;
            player.targetdir = x + 1;
            player.targetdir = y;
        }
    };
    /**玩家自己的移动 */
    AIServer.prototype.moveActor = function (player) {
        /**当前时间 */
        var now = egret.getTimer();
        /**上一次执行的时间 */
        var time = this.timeOnEnterFrame;
        /**时间间隔 */
        var pass = now - time;
        // console.log("onEnterFrame: ", (1000 / pass).toFixed(5), pass);
        /**移动速度 */
        var speed = player.speed * (pass / 16.66666);
        this.timeOnEnterFrame = egret.getTimer();
        if (player.targetdir == null)
            return;
        /**移动方向 */
        var vir;
        if (player.propStates[3].getPropType == 4) {
            if (Date.now() - this.drunkennessFrame >= 1000) {
                this.direction = Math.round(Math.random() * 360);
                this.drunkennessFrame = Date.now();
            }
            vir = {
                x: Math.sin(this.direction / 57.3) * 815,
                y: Math.cos(this.direction / 57.3) * 815
            };
        }
        else {
            vir = this.yaogan.getPosition();
        }
        if (vir == null) {
            return;
        }
        var dir = this.dir.setTo(vir.x, vir.y); // egret.Point.create(player.targetdir.x, player.targetdir.y);
        //判断玩家的射击
        this.checkShootPlayer(player);
        dir.normalize(speed);
        if (!player.isAI && DataProl.isXinShou && player.propStates[3].getPropType == 4) {
            var diftime = 0;
            /**判断道具效果是否结束 */
            diftime = Date.now() - player.propStates[3].PropStartTime;
            if (diftime > 3000) { }
            else {
                return;
            }
        }
        if (player.isAI && DataProl.isXinShou) {
            return;
        }
        if (!isNaN(dir.y)) {
            player.y += dir.y;
        }
        if (!isNaN(dir.x)) {
            player.x += dir.x;
        }
        /**圆周运动 */
        this.circlingMotion(player);
        if (!DataProl.isXinShou) {
            if (player.x > this.c.gameWidth - 55) {
                player.x = this.c.gameWidth - 55;
            }
            if (player.y > this.c.gameHeight - 65) {
                player.y = this.c.gameHeight - 65;
            }
            if (player.x < 50) {
                player.x = 50;
            }
            if (player.y < 60) {
                player.y = 60;
            }
        }
        else {
            if (player.x > GlobalData.GameStage_width * DataProl.gameSceneScal + 100 - player.size) {
                player.x = GlobalData.GameStage_width * DataProl.gameSceneScal + 100 - player.size;
            }
            if (player.y > GlobalData.GameStage_height * DataProl.gameSceneScal + 100 - player.size) {
                player.y = GlobalData.GameStage_height * DataProl.gameSceneScal + 100 - player.size;
            }
            if (player.x < 100 + player.size) {
                player.x = 100 + player.size;
            }
            if (player.y < 100 + player.size) {
                player.y = 100 + player.size;
            }
        }
    };
    /**青蛙移动 */
    AIServer.prototype.movePlayer = function (player) {
        if (player.targetdir == null)
            return;
        var dir = this.movePlayerTmpPoint.setTo(player.targetdir.x, player.targetdir.y);
        //判断玩家的射击
        this.checkShootPlayer(player);
        dir.normalize(player.speed);
        if (!player.isAI && DataProl.isXinShou && player.propStates[3].getPropType == 4) {
            var diftime = 0;
            /**判断道具效果是否结束 */
            diftime = Date.now() - player.propStates[3].PropStartTime;
            if (diftime > 3000) { }
            else {
                return;
            }
        }
        if (player.isAI && DataProl.isXinShou) {
            return;
        }
        if (!isNaN(dir.y)) {
            player.y += dir.y;
        }
        if (!isNaN(dir.x)) {
            player.x += dir.x;
        }
        /**圆周运动 */
        this.circlingMotion(player);
        if (!DataProl.isXinShou) {
            if (player.x > this.c.gameWidth - 55) {
                player.x = this.c.gameWidth - 55;
            }
            if (player.y > this.c.gameHeight - 65) {
                player.y = this.c.gameHeight - 65;
            }
            if (player.x < 50) {
                player.x = 50;
            }
            if (player.y < 60) {
                player.y = 60;
            }
        }
        else {
            if (player.x > GlobalData.GameStage_width * DataProl.gameSceneScal + 100 - player.size) {
                player.x = GlobalData.GameStage_width * DataProl.gameSceneScal + 100 - player.size;
            }
            if (player.y > GlobalData.GameStage_height * DataProl.gameSceneScal + 100 - player.size) {
                player.y = GlobalData.GameStage_height * DataProl.gameSceneScal + 100 - player.size;
            }
            if (player.x < 100 + player.size) {
                player.x = 100 + player.size;
            }
            if (player.y < 100 + player.size) {
                player.y = 100 + player.size;
            }
        }
    };
    // public checkHeart(player) {
    // 	/**
    // 	 * 判断玩家是否死亡
    // 	 */
    // 	if (player.death.isDeath) {
    // 		/**
    // 		 * 如果是AI的话，则重新让其生成
    // 		 */
    // 		if (player.isAI) {
    // 			var roomInfo = this.roomInfo;
    // 			if (roomInfo != null) {
    // 				if (roomInfo.userNumbers > this.c.minxUserCountByRoom) {
    // 					return 1;
    // 				}
    // 			}
    // 			this.respawnUser(player.userId);
    // 			return 0;
    // 		}
    // 		else {
    // 			var time = Date.now() - player.death.deadStartTime;
    // 			var value = this.c.userDeathInterval;
    // 			if (time > this.c.userDeathInterval) {
    // 				return 1;
    // 			}
    // 			else {
    // 				return 0;
    // 			}
    // 		}
    // 	}
    // 	//如果是AI的话就不考虑掉线的问题
    // 	if (player.isAI) {
    // 		return 0;
    // 	}
    // 	var hearttime = Date.now() - player.lastHeartbeat;
    // 	if (hearttime > this.c.maxHeartbeatInterval) {
    // 		console.log("玩家掉线" + hearttime);
    // 		return 1;
    // 	}
    // 	return 0;
    // }
    /**
    * 获取随机的位置
    */
    AIServer.prototype.getRandomPostion = function () {
        if (DataProl.isXinShou) {
            return { x: GlobalData.GameStage.stageWidth / 6 * DataProl.gameSceneScal + 100, y: GlobalData.GameStage.stageHeight / 3 * DataProl.gameSceneScal + 100 };
        }
        else {
            return {
                x: this.randomInRange(serverConfig.config.gameMapBorder, this.c.gameWidth - serverConfig.config.gameMapBorder),
                y: this.randomInRange(serverConfig.config.gameMapBorder, this.c.gameHeight - serverConfig.config.gameMapBorder)
                // x: this.randomInRange(100, 1000),
                // y: this.randomInRange(100, 500)
            };
        }
    };
    /**房间内AI初始化  AI加入房间 */
    AIServer.prototype.roomAIInit = function (AINumbers) {
        for (var t = 0; t < AINumbers; t++) {
            this.letOntAIjionRoom(t);
        }
    };
    /**更改单个AI青蛙颜色 */
    AIServer.prototype.setAitype = function (type) {
        for (var i = 0; i < this.roomInfo.roomUser.length; i++) {
            if (this.roomInfo.roomUser[i] != null) {
                if (this.roomInfo.roomUser[i].isAI) {
                    if (!this.roomInfo.roomUser[i].ishadLine) {
                        this.roomInfo.roomUser[i].frogType = type;
                    }
                }
            }
        }
    };
    /**更改AI等级 */
    AIServer.prototype.setAIlevel = function (grade) {
        for (var i = 0; i < this.roomInfo.roomUser.length; i++) {
            if (this.roomInfo.roomUser[i] != null) {
                if (this.roomInfo.roomUser[i].userId == DataProl.account) {
                    this.roomInfo.roomUser[i].grade = grade;
                    this.roomInfo.roomUser[i].lineLength = AIPropsMgr.getInstance().GetAttributesByGrade(grade).frogLineLength;
                    return;
                }
            }
        }
    };
    /**清空房间内ai*/
    AIServer.prototype.resetAi = function () {
        for (var i = this.roomInfo.roomUser.length - 1; i >= 0; i--) {
            if (this.roomInfo.roomUser[i] != null) {
                if (this.roomInfo.roomUser[i].isAI) {
                    /**从房间内踢出ai */
                    this.forceExitSpecRoom(this.roomInfo.roomUser[i], this.roomInfo);
                    /**重置ai */
                    //serverAIMgr.getInstance().resetAI(this.roomInfo.roomUser[i]);
                }
            }
        }
        this.roomInfo.roomUser;
    };
    /**让一个AI加入房间 */
    AIServer.prototype.letOntAIjionRoom = function (t) {
        var ai = serverAIMgr.getInstance().getAI();
        if (ai == null) {
            return;
        }
        /**清空ai状态*/
        AIUserMgr.getInstance().resetPlayer(ai);
        if (DataProl.tuanduizhan) {
            if (t % 2 == 0) {
                ai.troops = 0;
            }
            else {
                ai.troops = 1;
            }
        }
        ai.isUsed = true;
        //重新加入指定房间
        this.enterSpcRoom(ai, this.roomInfo);
    };
    /**生成一个ai青蛙 */
    AIServer.prototype.creatOneAifrog = function (type, point) {
        var ai = serverAIMgr.getInstance().getAI();
        if (ai == null) {
            return;
        }
        AIUserMgr.getInstance().resetPlayer(ai);
        ai.isUsed = true;
        ai.x = point.x;
        ai.y = point.y;
        ai.frogType = type;
        this.enterSpcRoom(ai, this.roomInfo);
    };
    /**生成一组连线ai */
    AIServer.prototype.createLinefrog = function (type, point1, point2, level) {
        //获取两个ai
        var ai1 = serverAIMgr.getInstance().getAI();
        var ai2 = serverAIMgr.getInstance().getAI();
        if (ai1 == null || ai2 == null) {
            return;
        }
        AIUserMgr.getInstance().resetPlayer(ai1);
        AIUserMgr.getInstance().resetPlayer(ai2);
        ai1.level = ai2.level = level;
        ai1.isUsed = true;
        ai2.isUsed = true;
        ai1.x = point1.x;
        ai1.y = point1.y;
        ai2.x = point2.x;
        ai2.y = point2.y;
        ai1.frogType = ai2.frogType = type;
        /**获取一条线 */
        var line = LineManager.getInstance().getOneLine(ai1.userId, ai2.userId);
        if (line == null) {
            return;
        }
        line.userOneId = ai1.userId;
        line.userTwoId = ai2.userId;
        line.isUsed = true;
        line.type = ai2.frogType;
        line.uop = { x: ai1.x, y: ai1.y };
        line.utp = { x: ai2.x, y: ai2.y };
        //此处因为使用的是临时生成的玩家，所以改动没有意义，我们需要改动原始的数据。
        ai1.ishadLine = true;
        ai1.otherLineUser = line.userTwoId;
        ai2.ishadLine = true;
        ai1.otherLineUser = line.userOneId;
        // console.log("创建一条线");
        this.roomInfo.roomLine.push(line);
        this.enterSpcRoom(ai1, this.roomInfo);
        this.enterSpcRoom(ai2, this.roomInfo);
    };
    /**删除新手引导中一组连线青蛙 */
    AIServer.prototype.deleteLineFrog = function (AI1, AI2) {
        // this.roomUserDied(this.roomInfo.roomUser[1]);
        // this.roomUserDied(this.roomInfo.roomUser[2]);
        this.roomInfo.roomUser[AI1].x = this.roomInfo.roomUser[AI1].y = 4000;
        this.roomInfo.roomUser[AI1].death.isDeath = true;
        this.roomInfo.roomUser[AI1].death.deadStartTime = Date.now();
        this.roomInfo.AINumbers--;
        if (AI2 == null) {
            return;
        }
        this.roomInfo.roomUser[AI2].x = this.roomInfo.roomUser[AI2].y = 4000;
        this.roomInfo.roomUser[AI2].death.isDeath = true;
        this.roomInfo.roomUser[AI2].death.deadStartTime = Date.now();
        this.roomInfo.AINumbers--;
    };
    /**加入房间 */
    AIServer.prototype.enterSpcRoom = function (user, room) {
        // if (room.roomUser.length >= this.c.maxUserCountByRoom) {
        // 	console.log("房间人数已满" + room.roomUser.length);
        // 	return 1;
        // }
        if (user.roomId > 0) {
            if (room.roomId == user.roomId) {
                return 1;
            }
        }
        //AIUserMgr.getInstance().resetPlayer(user);
        user.dressup.decorateId = (user.userId == DataProl.account) ? DataProl.userCurrentDressUp.decorateId : -1;
        user.dressup.trailingId = (user.userId == DataProl.account) ? DataProl.userCurrentDressUp.trailingId : -1;
        room.roomUser.push(user);
        user.roomId = room.roomId;
        if (!DataProl.isCreateRockerPlayer && DataProl.isDoubleRocker) {
            user.name = gameGlobal.global.playerName;
            if (!DataProl.isXinShou) {
                user.frogType = AIUserMgr.getInstance().currentPlayer.frogType;
                user.x = AIUserMgr.getInstance().currentPlayer.x + 10;
                user.y = AIUserMgr.getInstance().currentPlayer.y;
            }
            user.partner = AIUserMgr.getInstance().currentPlayer.userId;
            //user.otherLineUser = user.partner;
            AIUserMgr.getInstance().currentPlayer.partner = user.userId;
            //AIUserMgr.getInstance().currentPlayer.otherLineUser = AIUserMgr.getInstance().currentPlayer.partner;
            DataProl.isCreateRockerPlayer = true;
        }
        else {
            if (!DataProl.isXinShou) {
                var position = this.getRandomPostion();
                user.x = position.x;
                user.y = position.y;
            }
        }
        // if(!user.isAI)
        // modiftyUserAIbalance(room);
        AIUserMgr.getInstance().setProtectShiled(user);
        if (user.isAI) {
            room.AINumbers++;
        }
        else {
            room.userNumbers++;
        }
        return 0;
    };
    AIServer.prototype.respawnMessageManager = function (userId, name) {
        //var userId = user.userId;
        //var name = user.name;
        if (this.respawnUser(userId, name)) {
            console.log("重建青蛙成功" + name);
            //console.log("玩家重生成功");
            var player = this.userMgr.get(userId);
            if (player == null) {
                console.log("玩家重生中玩家不存在");
                return;
            }
            var roominfo = this.roomInfo;
            if (roominfo == null) {
                console.log("玩家重生中房间不存在");
                return;
            }
            this.enterSpcRoom(player, roominfo);
            //设置一个保护罩
            this.userMgr.setProtectShiled(player);
            /**发送房间时间 */
            // webNetworkMananger.getInstance().gameSceneRec.startrRoomTimer();
        }
        else {
            console.log("玩家重生失败");
        }
    };
    /**
     * 用来处理玩家的重生
     * 1、找到该玩家，清楚玩家死亡状态
     * 2、在房间中重新出生该玩家
     */
    AIServer.prototype.respawnUser = function (userId, name) {
        var roomInfo = this.roomInfo;
        var user = this.userMgr.get(userId);
        if (user == null) {
            console.log("玩家重生未找到玩家");
            return false;
        }
        //重置玩家的状态
        this.userMgr.resetPlayer(user, 100); //括号添加100，清零玩家击杀数，可防止玩家重生时出现击杀的墨镜表情
        user.dressup.decorateId = (user.userId == DataProl.account) ? DataProl.userCurrentDressUp.decorateId : -1;
        user.dressup.trailingId = (user.userId == DataProl.account) ? DataProl.userCurrentDressUp.trailingId : -1;
        user.roomId = 0;
        //
        if (this.forceExitSpecRoom(user, roomInfo)) {
            console.log("加入房间错误");
            return false;
        }
        user.name = name;
        return true;
    };
    AIServer.prototype.forceExitSpecRoom = function (user, room) {
        if (user == null) {
            console.log("退出房间失败 user为空");
            return;
        }
        if (room == null) {
            console.log("退出房间失败 玩家房间为空" + user.name);
            return;
        }
        if (Util.getInstance().findIndex(room.roomUser, user.id) > -1)
            room.roomUser.splice(Util.getInstance().findIndexEx(room.roomUser, user.userId), 1);
        if (user.isAI)
            room.AINumbers--;
        else
            room.userNumbers--;
    };
    return AIServer;
}());
__reflect(AIServer.prototype, "AIServer");
/**
 * 道具管理类
 *
 * 1.隐身
2.冰冻
3.剪刀
4.啤酒
5.变色
6.死亡荷叶
7.生成荷叶
 *
 *
 *
 *
 *
 *
 */
var AIPropsMgr = (function () {
    function AIPropsMgr() {
        //用缓存池子的方式来创建道具，独立模块，跟其他模块没有冲突
        this.propsPool = [];
        //用于
        this.dieLeafPool = [];
        this.roomProps = [];
        this.totalProps = 0;
        this.c = serverConfig.config;
        /**玩家管理 */
        this.userMgr = AIUserMgr.getInstance();
        this.getDistance = function (startPoint, endPoint) {
            var x = Math.abs(endPoint.x - startPoint.x);
            var y = Math.abs(endPoint.y - startPoint.y);
            return Math.sqrt(x * x + y * y);
        };
        this.getPointToLineDistance = function (p1, p2, p) {
            var ans = 0;
            var a = this.getDistance(p1, p2);
            var b = this.getDistance(p1, p);
            var c = this.getDistance(p2, p);
            if (c + b == a) {
                ans = 0;
                return ans;
            }
            if (a <= 0.00001) {
                ans = b;
                return ans;
            }
            if (c * c >= a * a + b * b) {
                ans = b;
                return ans;
            }
            if (b * b >= a * a + c * c) {
                ans = c;
                return ans;
            }
            // 组成锐角三角形，则求三角形的高
            var p0 = (a + b + c) / 2; // 半周长
            var s = Math.sqrt(p0 * (p0 - a) * (p0 - b) * (p0 - c)); // 海伦公式求面积
            ans = 2 * s / a; // 返回点到线的距离（利用三角形面积公式求高）
            return ans;
        };
    }
    AIPropsMgr.getInstance = function () {
        if (this.instance == null) {
            this.instance = new AIPropsMgr();
        }
        return this.instance;
    };
    // 1.创建道具
    // 2.获取道具
    // 3.返还道具
    // 4.获取道具数目
    // gy
    //将指定房间的道具进行初始化
    AIPropsMgr.prototype.roomPorpsInit = function () {
        // //取出指定的房间
        var garbageProp = 0;
        //归还所有的道具
        for (var t = 0; t < this.roomProps.length; t++) {
            //清空所有存在切不使用的道具
            if (this.roomProps[t].isUsed) {
                this.recoverProp(this.roomProps[t]);
                garbageProp++;
            }
        }
        //console.log("roommgr 回收道具" + t);
        //console.log("roommgr 回收过道具" + garbageProp);
        //清空整个缓存池子
        this.roomProps = [];
        //创建新的道具
        this.generateProps();
        //	console.log("道具重生后" + this.roomProps.length);
        return this.roomProps;
    };
    /**
     * 创建所有的随机道具
     */
    AIPropsMgr.prototype.generateProps = function () {
        if (DataProl.isXinShou) {
            return;
        }
        else {
            for (var i = 0; i < this.c.propMaxnum; i++) {
                this.generateProp();
            }
        }
    };
    AIPropsMgr.prototype.getRoomProps = function () {
        return this.roomProps;
    };
    //判断所有道具和线的距离
    /**
     * 判断道具和线的距离，如果有道具消失了，则重新生成道具，然后通知给服务器
     * @param {*} lines
     * @param {*} props
     */
    AIPropsMgr.prototype.newUserPorpDied = function (roomUser, props) {
        var usrstart;
        var usrend;
        var userPoint;
        var isRemoveProp = false;
        /**
         * 记录重生的道具的数量
         */
        var rebornPorpNumbser = 0;
        for (var m = (props.length - 1); m >= 0; m--) {
            isRemoveProp = false;
            for (var n = 0; n < roomUser.length; n++) {
                if (roomUser[n] == null)
                    continue;
                if (roomUser[n].isDeath)
                    continue;
                if (isRemoveProp) {
                    //console.log("该道具已经被上个线消除过");
                    continue;
                }
                userPoint = { x: props[m].x, y: props[m].y };
                if (this.isCrash(50, userPoint, roomUser[n])) {
                    //console.log("碰到道具");
                    if (roomUser[n].propStates[3].getPropType == 4 && DataProl.isXinShou) {
                        return;
                    }
                    this.changeSinglePlayerState(props[m], roomUser[n]);
                    this.recoverProp(this.roomProps[m]);
                    if (props[m].type != 7 && !DataProl.isXinShou) {
                        rebornPorpNumbser++;
                    }
                    if (this.findIndex(props, props[m].id) > -1)
                        props.splice(this.findIndex(props, props[m].id), 1);
                    isRemoveProp = true;
                }
            }
        }
        return rebornPorpNumbser;
    };
    /**获取随机颜色 */
    AIPropsMgr.prototype.getRandomColor = function (playColor) {
        var randomColor = playColor;
        while (playColor == randomColor) {
            randomColor = Math.floor(Math.random() * this.c.maxFrigtype);
        }
        return randomColor;
    };
    /**更改单个玩家的状态 */
    AIPropsMgr.prototype.changeSinglePlayerState = function (prop, Player) {
        if (prop.type == 2) {
            Player.speed = 0;
        }
        if (prop.type == 9) {
            Player.speed = 0;
        }
        if (prop.type == 8) {
            Player.speed = 0;
        }
        if (prop.type == 5) {
            //Player.displayEffectOfProps(prop.type) ;
            var frogtype = Player.frogType;
            if (Player.ishadLine) {
                frogtype = Player.frogType;
                return;
            }
            else {
                do {
                    frogtype = this.getRandomColor(Player.frogType);
                } while (frogtype == Player.frogType);
            }
            Player.frogType = frogtype;
            // do {
            // 	//Player.displayEffectOfProps(prop.type) ;
            // 	var frogtype = Player.frogType;
            // 	Player.frogType = Math.floor(Math.random() * this.c.maxFrigtype);
            // } while (frogtype == Player.frogType);
        }
        if (prop.type == 7 || prop.type == 6) {
            if (!Player.ishadLine) {
                if (prop.isUsed) {
                    Player.grade += prop.grade;
                    Player.lineLength = this.GetAttributesByGrade(Player.grade).frogLineLength;
                    Player.level = this.GetAttributesByGrade(Player.grade).level;
                }
            }
            else {
                if (webNetworkMananger.getInstance().gameSceneRec != null) {
                    if (webNetworkMananger.getInstance().gameSceneRec.m_createAllFrogs != null) {
                        var frog = webNetworkMananger.getInstance().gameSceneRec.m_createAllFrogs.getLigatureUserId(Player.userId);
                        if (frog != null) {
                            Player.grade += Math.round(prop.grade / 2);
                            frog.grade += Math.round(prop.grade / 2);
                            Player.level = this.GetAttributesByGrade(Player.grade).level;
                            frog.level = this.GetAttributesByGrade(frog.grade).level;
                            Player.lineLength = this.GetAttributesByGrade(Player.grade).frogLineLength;
                            frog.lineLength = this.GetAttributesByGrade(frog.grade).frogLineLength;
                        }
                    }
                }
            }
        }
        //无论碰到了任何道具，则更改其状态，同时也不改变其状态
        //if (prop.type != 7 && prop.type != 6) {
        if (prop.type != 7) {
            Player.propStates[prop.type - 1].getPropType = prop.type;
        }
        if (prop.type != 7 && prop.type != 6) {
            Player.propStates[prop.type - 1].PropStartTime = Date.now();
            //Player.propStates.lastProp=lastPropstates.type
        }
        if (DataProl.isXinShou && prop.type < 7) {
            webNetworkMananger.getInstance().gameSceneRec.displayer_prop_message(this.changeGuideType(prop.type) - 1); //xinshou中的单个道具面板显示
            return;
        }
    };
    //根据策划要求在新手引导显示相应的道具
    AIPropsMgr.prototype.changeGuideType = function (type) {
        var tmp = 0;
        switch (type) {
            case 1:
                tmp = 4;
                break;
            case 2:
                tmp = 3;
                break;
            case 3:
                tmp = 5;
                break;
            case 4:
                tmp = 6;
                break;
            case 5:
                tmp = 2;
                break;
            case 6:
                tmp = 1;
                break;
            default:
                tmp = 0;
                break;
        }
        return tmp;
    };
    ;
    /**通过分数获取(舌长、舌宽、等级)属性
     * @param grade 分数
     */
    AIPropsMgr.prototype.GetAttributesByGrade = function (grade) {
        /**舌宽 */
        var tongueWideData = 0;
        /**线长 */
        var lineLength = 0;
        /**等级 */
        var rank = 0;
        if (parseInt(grade) >= 15000) {
            tongueWideData = 15;
            lineLength = 600;
            rank = 41;
        }
        else if (parseInt(grade) >= 9000) {
            tongueWideData = 13;
            lineLength = 500;
            rank = 36;
        }
        else if (parseInt(grade) >= 7800) {
            tongueWideData = 13;
            lineLength = 460;
            rank = 35;
        }
        else if (parseInt(grade) >= 6600) {
            tongueWideData = 12;
            lineLength = 420;
            rank = 34;
        }
        else if (parseInt(grade) >= 5600) {
            tongueWideData = 12;
            lineLength = 380;
            rank = 33;
        }
        else if (parseInt(grade) >= 4800) {
            tongueWideData = 11;
            lineLength = 350;
            rank = 32;
        }
        else if (parseInt(grade) >= 4000) {
            tongueWideData = 11;
            lineLength = 320;
            rank = 31;
        }
        else if (parseInt(grade) >= 3200) {
            tongueWideData = 10;
            lineLength = 280;
            rank = 26;
        }
        else if (parseInt(grade) >= 2600) {
            tongueWideData = 10;
            lineLength = 260;
            rank = 25;
        }
        else if (parseInt(grade) >= 2100) {
            tongueWideData = 9;
            lineLength = 240;
            rank = 24;
        }
        else if (parseInt(grade) >= 1700) {
            tongueWideData = 9;
            lineLength = 220;
            rank = 23;
        }
        else if (parseInt(grade) >= 1300) {
            tongueWideData = 8;
            lineLength = 200;
            rank = 22;
        }
        else if (parseInt(grade) >= 1000) {
            tongueWideData = 8;
            lineLength = 180;
            rank = 21;
        }
        else if (parseInt(grade) >= 700) {
            tongueWideData = 7;
            lineLength = 150;
            rank = 16;
        }
        else if (parseInt(grade) >= 550) {
            tongueWideData = 7;
            lineLength = 140;
            rank = 15;
        }
        else if (parseInt(grade) >= 400) {
            tongueWideData = 6;
            lineLength = 130;
            rank = 14;
        }
        else if (parseInt(grade) >= 250) {
            tongueWideData = 6;
            lineLength = 120;
            rank = 13;
        }
        else if (parseInt(grade) >= 100) {
            tongueWideData = 5;
            lineLength = 110;
            rank = 12;
        }
        else {
            tongueWideData = 5;
            lineLength = 100;
            rank = 11;
        }
        return {
            tongueWide: tongueWideData * frogConfig.Tongue_width_coefficient,
            frogLineLength: lineLength * frogConfig.Long_tongue_coefficient,
            level: rank,
        };
    };
    AIPropsMgr.prototype.isCrash = function (maxlength, p1, p2) {
        if (Util.getInstance().isNull(maxlength) || Util.getInstance().isNull(p1) || Util.getInstance().isNull(p2)) {
            console.log("there is null");
            return false;
        }
        var lenght = this.getDistance(p1, p2);
        return maxlength > lenght ? true : false;
    };
    //判断所有道具和线的距离
    /**
     * 判断道具和线的距离，如果有道具消失了，则重新生成道具，然后通知给服务器
     * @param {*} lines
     * @param {*} props
     */
    AIPropsMgr.prototype.userPorpDied = function (lines, props) {
        var usrstart;
        var usrend;
        var userPoint;
        var isRemoveProp = false;
        /**
         * 记录重生的道具的数量
         */
        var rebornPorpNumbser = 0;
        for (var m = (props.length - 1); m >= 0; m--) {
            isRemoveProp = false;
            for (var n = 0; n < lines.length; n++) {
                if (lines[n] == null)
                    continue;
                if (lines[n].userOneId < 0 || lines[n].userTwoId < 0)
                    continue;
                usrstart = this.userMgr.get(lines[n].userOneId);
                if (usrstart == null) {
                    console.log("usrstart==null");
                    continue;
                }
                usrend = this.userMgr.get(lines[n].userTwoId);
                if (usrend == null) {
                    console.log("usrend==null");
                    continue;
                }
                if (isRemoveProp) {
                    //console.log("该道具已经被上个线消除过");
                    continue;
                }
                userPoint = { x: props[m].x, y: props[m].y };
                if (this.checkLineIsOnALine(userPoint, usrend, usrstart)) {
                    if (!usrend.isAI) {
                        SoundManager.getInstance().playEffectSound("Kill_mp3");
                    }
                    if (!usrstart.isAI) {
                        SoundManager.getInstance().playEffectSound("Kill_mp3");
                    }
                    //console.log("消除道具的位置" + userPoint.x + "," + userPoint.y);
                    this.recoverProp(props[m]);
                    if (props[m].type != 7) {
                        rebornPorpNumbser++;
                    }
                    if (this.findIndex(props, props[m].id) > -1)
                        props.splice(this.findIndex(props, props[m].id), 1);
                    isRemoveProp = true;
                }
            }
        }
        return rebornPorpNumbser;
    };
    /**生成一个道具并添加到对象池 */
    AIPropsMgr.prototype.createOneProp = function (index) {
        this.propsPool.push({
            isUsed: false,
            id: index,
            x: 0,
            y: 0,
            type: 0,
            tweenx: 0,
            tweeny: 0,
            grade: 0,
            isInRange: true
        });
        this.totalProps++;
    };
    AIPropsMgr.prototype.createdieLeafProp = function (index) {
        this.dieLeafPool.push({
            isUsed: false,
            id: index + 100,
            x: 0,
            y: 0,
            type: 0,
            tweenx: 0,
            tweeny: 0,
            grade: 0,
            isInRange: true
        });
        this.totalProps++;
    };
    AIPropsMgr.prototype.createExtOneProp = function () {
        this.totalProps++;
        this.propsPool.push({
            isUsed: false,
            id: this.totalProps,
            x: 0,
            y: 0,
            type: 0,
            tweenx: 0,
            tweeny: 0,
            grade: 0,
            isInRange: true
        });
        return this.propsPool[this.totalProps - 1];
    };
    AIPropsMgr.prototype.createProps = function () {
        this.totalProps = 0;
        if (this.c == null) {
            console.log('create room fail!!!!config==null');
            return;
        }
        var numbers = this.c.propMaxnum;
        if (DataProl.isXinShou) {
            numbers = 6;
        }
        if (numbers <= 0) {
            console.log('create room fail!!!!num+numbers');
            return;
        }
        console.log('创建道具数目' + numbers);
        //遍历所有道具
        for (var i = 0; i < numbers; ++i) {
            this.createOneProp(i);
        }
        for (var i = 0; i < numbers; ++i) {
            this.createdieLeafProp(i);
        }
    };
    ;
    /**清空房间内所有道具 */
    AIPropsMgr.prototype.cleanRoomAI = function () {
        for (var i = 0; i < this.propsPool.length; ++i) {
            this.recoverProp(this.propsPool[i]);
        }
        this.dieLeaf();
        this.roomProps = [];
        AIServer.getInstance().roomInfo.roomProps = [];
    };
    AIPropsMgr.prototype.dieLeaf = function () {
        for (var i = 0; i < this.dieLeafPool.length; ++i) {
            this.recoverProp(this.dieLeafPool[i]);
        }
    };
    /**新手引导清空房间内所有道具 */
    AIPropsMgr.prototype.cleanRoom_Allprop = function () {
        for (var i = 0; i < this.propsPool.length; ++i) {
            this.recoverProp(this.propsPool[i]);
        }
        this.dieLeaf();
    };
    AIPropsMgr.prototype.restAllProps = function () {
        this.cleanRoomAI();
        this.roomProps = [];
        this.totalProps = 0;
    };
    /**
     * 回收不使用的道具
     */
    AIPropsMgr.prototype.recoverProp = function (prop) {
        if (prop != null) {
            prop.isUsed = false;
        }
    };
    ;
    /**创建新手引导道具 一组 */
    AIPropsMgr.prototype.NewbieProp = function (i) {
        var position = this.getPropPutPoint(i);
        //获取一个道具
        var prop = this.getOneProp();
        if (prop == null) {
            console.log('道具创建失败d:');
            return;
        }
        prop.x = position.x * DataProl.gameSceneScal + 100;
        prop.y = position.y * DataProl.gameSceneScal + 100;
        prop.type = i + 1;
        if (prop.type == 6) {
            prop.grade = 9000;
        }
        prop.isUsed = true;
        this.roomProps.push(prop);
    };
    /**获取新手引导道具摆放位置
     * @param num 道具序号
     */
    AIPropsMgr.prototype.getPropPutPoint = function (num) {
        switch (num) {
            case 0:
                return { x: GlobalData.GameStage.stageWidth / 4, y: GlobalData.GameStage.stageHeight / 3 * 2 };
            case 1:
                return { x: GlobalData.GameStage.stageWidth / 4 * 3, y: GlobalData.GameStage.stageHeight / 3 };
            case 2:
                return { x: GlobalData.GameStage.stageWidth / 2, y: GlobalData.GameStage.stageHeight / 3 * 2 };
            case 3:
                return { x: GlobalData.GameStage.stageWidth / 4 * 3, y: GlobalData.GameStage.stageHeight / 3 * 2 };
            case 4:
                return { x: GlobalData.GameStage.stageWidth / 2, y: GlobalData.GameStage.stageHeight / 3 };
            case 5:
                return { x: GlobalData.GameStage.stageWidth / 4, y: GlobalData.GameStage.stageHeight / 3 };
        }
    };
    /**创建新手引导道具 一个 */
    AIPropsMgr.prototype.NewbieOneProp = function (type, point) {
        //获取一个道具
        var prop = this.getOneProp();
        if (prop == null) {
            console.log('道具创建失败d:');
            return;
        }
        prop.x = point.x;
        prop.y = point.y;
        prop.type = type;
        if (prop.type == 6) {
            prop.grade = 20;
        }
        prop.isUsed = true;
        this.roomProps.push(prop);
        AIServer.getInstance().roomInfo.roomProps = this.roomProps;
    };
    /**创建一个道具 */
    AIPropsMgr.prototype.generateProp = function () {
        var position = this.c.foodUniformDisposition ? this.uniformPosition(this.roomProps, serverConfig.config.gameMapBorder) : this.randomPosition(serverConfig.config.gameMapBorder);
        //获取一个道具
        var prop = this.getOneProp();
        if (prop == null) {
            console.log('道具创建失败d:');
            return;
        }
        prop.x = position.x;
        prop.y = position.y;
        //检查一下道具数量
        var nowallprop = this.allPropnum();
        //比较一下道具数量
        var lackprop = this.comparenum(nowallprop);
        if (lackprop != null && lackprop != undefined) {
            prop.type = lackprop.type;
            if (prop.type == 6) {
                prop.grade = lackprop.grade;
                return;
            }
            //  console.log("重生的道具的位置" + prop.x + "," + prop.y);
            this.roomProps.push(prop);
        }
        else {
            return;
        }
    };
    /**检查当前道具数量 */
    AIPropsMgr.prototype.comparenum = function (nowallprop) {
        if (nowallprop[0].num < this.c.propRatio.hide * this.c.propMaxnum) {
            return { type: nowallprop[0].type, grade: nowallprop[0].grade };
        }
        else if (nowallprop[1].num < this.c.propRatio.ice * this.c.propMaxnum) {
            return { type: nowallprop[1].type, grade: nowallprop[1].grade };
        }
        else if (nowallprop[2].num < this.c.propRatio.cut * this.c.propMaxnum) {
            return { type: nowallprop[2].type, grade: nowallprop[2].grade };
        }
        else if (nowallprop[3].num < this.c.propRatio.drink * this.c.propMaxnum) {
            return { type: nowallprop[3].type, grade: nowallprop[3].grade };
        }
        else if (nowallprop[4].num < this.c.propRatio.change * this.c.propMaxnum) {
            return { type: nowallprop[4].type, grade: nowallprop[4].grade };
        }
        else if (nowallprop[5].num < this.c.propRatio.minleaf * this.c.propMaxnum) {
            return { type: nowallprop[5].type, grade: nowallprop[5].grade };
        }
        else if (nowallprop[6].num < this.c.propRatio.lesserleaf * this.c.propMaxnum) {
            return { type: nowallprop[6].type, grade: nowallprop[6].grade };
        }
        else if (nowallprop[7].num < this.c.propRatio.mediumleaf * this.c.propMaxnum) {
            return { type: nowallprop[7].type, grade: nowallprop[7].grade };
        }
        else if (nowallprop[8].num < this.c.propRatio.maxleaf * this.c.propMaxnum) {
            return { type: nowallprop[8].type, grade: nowallprop[8].grade };
        }
    };
    /**计算道具数量 */
    AIPropsMgr.prototype.allPropnum = function () {
        //所有道具当前数量数组
        var nowallprop = [];
        // 将所有道具存如数组依次为隐身，冰，剪刀，喝酒，变色，
        //2分荷叶，5分荷叶，20分荷叶，50分荷叶
        for (var i = 0; i < 9; i++) {
            //type  依次为隐身，冰，剪刀，喝酒，变色，荷叶
            var nowprop = {
                type: 0,
                num: 0,
                grade: 0,
            };
            //给道具赋值类型和分数 避免第一次为空
            if (i < 5) {
                nowprop.type = i + 1;
            }
            if (i >= 5) {
                nowprop.type = 6;
            }
            nowallprop.push(nowprop);
        }
        nowallprop[5].grade = 2;
        nowallprop[6].grade = 5;
        nowallprop[7].grade = 20;
        nowallprop[8].grade = 50;
        //遍历房间列表 记录道具数
        for (var i = 0; i < this.roomProps.length; i++) {
            var prop_1 = this.roomProps[i];
            //给当前道具数量数组赋值
            this.propnum(prop_1, nowallprop);
        }
        return nowallprop;
    };
    /**给当前道具数量数组赋值 */
    AIPropsMgr.prototype.propnum = function (prop, nowallprop) {
        switch (prop.type) {
            case 1:
                nowallprop[0].type = 1;
                nowallprop[0].num++;
                break;
            case 2:
                nowallprop[1].type = 2;
                nowallprop[1].num++;
                break;
            case 3:
                nowallprop[2].type = 3;
                nowallprop[2].num++;
                break;
            case 4:
                nowallprop[3].type = 4;
                nowallprop[3].num++;
                break;
            case 5:
                nowallprop[4].type = 5;
                nowallprop[4].num++;
                break;
            case 6:
                if (prop.grade == 2) {
                    nowallprop[5].type = 6;
                    nowallprop[5].num++;
                    nowallprop[1].grade = 2;
                }
                if (prop.grade == 5) {
                    nowallprop[6].type = 6;
                    nowallprop[6].num++;
                    nowallprop[6].grade = 5;
                }
                if (prop.grade == 20) {
                    nowallprop[7].type = 6;
                    nowallprop[7].num++;
                    nowallprop[7].grade = 20;
                }
                if (prop.grade == 50) {
                    nowallprop[8].type = 6;
                    nowallprop[8].num++;
                    nowallprop[8].grade = 50;
                }
                break;
        }
    };
    /**荷叶生成 */
    AIPropsMgr.prototype.createLeaf = function (x, y, lineLength) {
        //获取荷叶分数和数量数组
        var leafarr = this.cteateLeafNum(lineLength);
        if (leafarr == null) {
            return;
        }
        //生成荷叶并给荷叶定位
        for (var i = 0; i < leafarr.length; i++) {
            var prop = this.getOneDieLeaf();
            if (prop == null) {
                console.log('道具创建失败d:');
                return;
            }
            //给荷叶赋位置
            this.LeafPlace(prop, leafarr, i, x, y);
            //给荷叶的tween动画其实位置赋值
            prop.tweenx = x;
            prop.tweeny = y;
            prop.type = 7;
            this.roomProps.push(prop);
            //console.log("生成荷叶");
        }
    };
    /**荷叶位置 */
    AIPropsMgr.prototype.LeafPlace = function (prop, leafarr, i, x, y) {
        switch (i) {
            case 0:
                prop.x = x + 100;
                prop.y = y;
                prop.grade = leafarr[i];
                break;
            case 1:
                prop.x = x - 100;
                prop.y = y;
                prop.grade = leafarr[i];
                break;
            case 2:
                prop.x = x;
                prop.y = y + 100;
                prop.grade = leafarr[i];
                break;
            case 3:
                prop.x = x;
                prop.y = y - 100;
                prop.grade = leafarr[i];
                break;
            case 4:
                prop.x = x + 50;
                prop.y = y + 87;
                prop.grade = leafarr[i];
                break;
            case 5:
                prop.x = x + 87;
                prop.y = y - 50;
                prop.grade = leafarr[i];
                break;
            case 6:
                prop.x = x - 50;
                prop.y = y - 87;
                prop.grade = leafarr[i];
                break;
            case 7:
                prop.x = x - 50;
                prop.y = y + 87;
                prop.grade = leafarr[i];
                break;
            case 8:
                prop.x = x + 87;
                prop.y = y + 50;
                prop.grade = leafarr[i];
                break;
            case 9:
                prop.x = x + 50;
                prop.y = y - 87;
                prop.grade = leafarr[i];
                break;
            case 10:
                prop.x = x - 87;
                prop.y = y - 50;
                prop.grade = leafarr[i];
                break;
            case 11:
                prop.x = x - 87;
                prop.y = y + 50;
                prop.grade = leafarr[i];
                break;
        }
        //检测荷叶位置是否在界内
        this.determinePosition(prop);
    };
    /**计算生成荷叶数量与分数 */
    AIPropsMgr.prototype.cteateLeafNum = function (lineLength) {
        //存放分数数组
        var leafgrade = [];
        //将青蛙分数取整 不足50按50计算
        var tens = lineLength / 10 % 10;
        if (tens < 5) {
            lineLength += (5 - tens) * 10;
        }
        if (tens > 5) {
            lineLength += (10 - tens) * 10;
        }
        //荷叶总分
        var leafmaxgrade = lineLength * 0.4;
        //通过循环试出min--最小荷叶less--稍小荷叶
        //med--稍大荷叶  max 大荷叶的数量并赋分存入数组
        for (var min = 0; min < 12; min++) {
            for (var less = 0; less < 12; less++) {
                for (var med = 0; med < 12; med++) {
                    for (var max = 0; max < 12; max++) {
                        if (lineLength * 0.4 <= 600) {
                            if (min + less + med + max > 4 && min + less + med + max < 13 && 2 * min + 5 * less + 20 * med + 50 * max == leafmaxgrade) {
                                for (var num = 0; num < min; num++) {
                                    leafgrade.push(2);
                                }
                                for (var num = 0; num < less; num++) {
                                    leafgrade.push(5);
                                }
                                for (var num = 0; num < med; num++) {
                                    leafgrade.push(20);
                                }
                                for (var num = 0; num < max; num++) {
                                    leafgrade.push(50);
                                }
                                return leafgrade;
                            }
                        }
                        else {
                            for (var i = 0; i < 12; i++) {
                                leafgrade.push(Math.round(leafmaxgrade / 12));
                            }
                            return leafgrade;
                        }
                    }
                }
            }
        }
        return leafgrade;
    };
    /**判断荷叶位置 */
    AIPropsMgr.prototype.determinePosition = function (prop) {
        if (prop.x > this.c.gameWidth - 55) {
            prop.x = this.c.gameWidth - 55;
        }
        if (prop.y > this.c.gameHeight - 65) {
            prop.y = this.c.gameHeight - 65;
        }
        if (prop.x < 50) {
            prop.x = 50;
        }
        if (prop.y < 60) {
            prop.y = 60;
        }
    };
    //获取一个死亡的荷叶
    AIPropsMgr.prototype.getOneDieLeaf = function () {
        for (var i = 0; i < this.dieLeafPool.length; ++i) {
            if (!this.dieLeafPool[i].isUsed) {
                this.dieLeafPool[i].isUsed = true;
                return this.dieLeafPool[i];
            }
        }
    };
    AIPropsMgr.prototype.getOneProp = function () {
        //获取当前没有使用的道具
        for (var i = 0; i < this.propsPool.length; ++i) {
            if (!this.propsPool[i].isUsed) {
                this.propsPool[i].isUsed = true;
                return this.propsPool[i];
            }
        }
        //没有未使用的则再创建一个
        // if (this.c.isproppoolext)
        // 	return this.createExtOneProp();
        // else
        // 	return;
    };
    ;
    AIPropsMgr.prototype.getTotalProps = function () {
        return this.totalProps;
    };
    ;
    AIPropsMgr.prototype.uniformPosition = function (points, radius) {
        var bestCandidate, maxDistance = 0;
        var numberOfCandidates = 10;
        if (points.length === 0) {
            return this.randomPosition(radius);
        }
        // Generate the candidates
        for (var ci = 0; ci < numberOfCandidates; ci++) {
            var minDistance = Infinity;
            var candidate = this.randomPosition(radius);
            candidate.radius = radius;
            for (var pi = 0; pi < points.length; pi++) {
                var distance = this.getDistance(candidate, points[pi]);
                if (distance < minDistance) {
                    minDistance = distance;
                }
            }
            if (minDistance > maxDistance) {
                bestCandidate = candidate;
                maxDistance = minDistance;
            }
            else {
                return this.randomPosition(radius);
            }
        }
        return bestCandidate;
    };
    ;
    AIPropsMgr.prototype.randomInRange = function (from, to) {
        return Math.floor(Math.random() * (to - from)) + from;
    };
    ;
    // generate a random position within the field of play
    AIPropsMgr.prototype.randomPosition = function (radius) {
        return {
            x: this.randomInRange(radius, gameGlobal.global.gameWidth - radius),
            y: this.randomInRange(radius, gameGlobal.global.gameHeight - radius)
        };
    };
    ;
    AIPropsMgr.prototype.checkLineIsOnALine = function (something, usrend, usrstart) {
        /**点到线的距离 */
        var pointToLineLength = this.getPointToLineDistance(usrend, usrstart, something);
        //  console.log("pointToLineLength="+pointToLineLength);
        return pointToLineLength < 50 ? true : false;
    };
    AIPropsMgr.prototype.findIndex = function (arr, id) {
        var len = arr.length;
        while (len--) {
            if (arr[len].id === id) {
                return len;
            }
        }
        return -1;
    };
    ;
    return AIPropsMgr;
}());
__reflect(AIPropsMgr.prototype, "AIPropsMgr");
var LineManager = (function () {
    function LineManager() {
        this.userMgr = AIUserMgr.getInstance();
        this.util = Util.getInstance();
        this.linesPool = [];
        this.totallinesPool = 0;
        this.c = serverConfig.config;
        this.HadLineP0tmp = new egret.Point(0, 0);
        this.HadLineP1tmp = new egret.Point(0, 0);
        this.calulateP0tmp = new egret.Point(0, 0);
        this.calulateP1tmp = new egret.Point(0, 0);
        this.calulatePopDirPoint = new egret.Point();
        this.P0 = new egret.Point();
    }
    LineManager.getInstance = function () {
        if (this.instance == null) {
            this.instance = new LineManager();
        }
        return this.instance;
    };
    //++++++++++roommgr++++++++++++++//
    //private roomLine = [];
    //判断指定的线是否还存在
    LineManager.prototype.checklines = function (users, room) {
        var roomLine = room.roomLine;
        //判断所有的线是否存在
        this.checkLinesAlive(roomLine);
        //判断是否有新的线的产生
        this.createNewLines(room.roomUser, room);
        return roomLine;
    };
    /**
     * 创建新的线
     * @param {*} users
     */
    LineManager.prototype.createNewLines = function (users, room) {
        for (var t = 0; t < users.length; t++) {
            if (users[t].userId != -1 && !users[t].death.isDeath) {
                if (this.alreadyExistLine(users[t].userId, room)) {
                    if (users[t].death.isDeath || users[t].ishadLine)
                        continue;
                    // if (users[t].propStates.getPropType == 3)
                    // 	continue;
                    if (users[t].disconnection_line)
                        continue;
                    if (this.c.isLineAutoConnect) {
                        this.checkUserHadLine(users[t], users, room);
                    }
                }
            }
        }
    };
    LineManager.prototype.alreadyExistLine = function (id, room) {
        for (var t = 0; t < room.roomLine.length; t++) {
            if (room.roomLine[t].userOneId == id || room.roomLine[t].userTwoId == id) {
                //已经和青蛙相连的青蛙创建过线
                return false;
            }
        }
        return true;
    };
    /**
     * 判断玩家是否可以创建线
     * 遍历房间内所有玩家，进行连线
     */
    LineManager.prototype.checkUserHadLine = function (targetplayer, users, room) {
        var roomLine = room.roomLine;
        if (targetplayer.userId == -1) {
            return;
        }
        if (targetplayer.states != 0) {
            return;
        }
        targetplayer = this.userMgr.get(targetplayer.userId);
        if (targetplayer == null) {
            return;
        }
        /*if (targetplayer.userId == DataProl.account) {
            return;
        }*/
        /*	if (targetplayer.ishadLine) {
                //player身上ishadline不可信
                this.setIsHadLineFalse(room, targetplayer);
                if (targetplayer.ishadLine) {
                    //	console.log("aaaaaa" + targetplayer.otherLineUser);
                    return;
                }

            } else {
                if (targetplayer.otherLineUser != -1) {

                    return;
                }
            }*/
        //判断一下两个玩家之间的距离是否是最短距离
        var minUserDistance = 10000;
        var minLineUser = null;
        var userOne, userTwo;
        for (var t = 0; t < users.length; t++) {
            if (users[t].userId == targetplayer.otherLineUser)
                continue;
            if (users[t].userId == targetplayer.userId)
                continue;
            /*if (users[t].userId == DataProl.account)
                continue;*/
            if (users[t].states != 0)
                continue;
            var nowDistance = this.util.getDistance(targetplayer, users[t]);
            //var tagetLength = targetplayer.lineLength + users[t].lineLength;
            /**遍历所有玩家 */
            if (nowDistance < 50) {
                if (nowDistance < minUserDistance) {
                    minUserDistance = nowDistance;
                    minLineUser = users[t];
                    continue;
                }
            }
        }
        if (minLineUser != null) {
            if (minLineUser.ishadLine || targetplayer.ishadLine) {
                this.HadLineP0tmp.setTo(minLineUser.x, minLineUser.y);
                this.HadLineP1tmp.setTo(targetplayer.x, targetplayer.y);
                var point1 = this.calulatePopDir(this.HadLineP1tmp, this.HadLineP0tmp, targetplayer.level, minLineUser.level);
                var point2 = this.calulatePopDir(this.HadLineP0tmp, this.HadLineP1tmp, minLineUser.level, targetplayer.level);
                if (minLineUser.propStates[1].getPropType != 2) {
                    //让青蛙眩晕
                    AIPropsMgr.getInstance().changeSinglePlayerState({ type: 8 }, minLineUser);
                    //变更服务器上青蛙位置避免一直触发碰撞
                    this.frogchangepoint(minLineUser, point2);
                    //获取tween动画方法
                    this.getflicktween(point2, minLineUser);
                }
                if (targetplayer.propStates[1].getPropType != 2) {
                    //让青蛙眩晕
                    AIPropsMgr.getInstance().changeSinglePlayerState({ type: 8 }, targetplayer);
                    //变更服务器上青蛙位置避免一直触发碰撞
                    this.frogchangepoint(targetplayer, point1);
                    //获取tween动画方法
                    this.getflicktween(point1, targetplayer);
                }
                return;
            }
            else {
                if (minLineUser.frogType != targetplayer.frogType || minLineUser.disconnection_line) {
                    this.HadLineP0tmp.setTo(minLineUser.x, minLineUser.y);
                    this.HadLineP1tmp.setTo(targetplayer.x, targetplayer.y);
                    var point1 = this.calulatePopDir(this.HadLineP1tmp, this.HadLineP0tmp, targetplayer.level, minLineUser.level);
                    var point2 = this.calulatePopDir(this.HadLineP0tmp, this.HadLineP1tmp, minLineUser.level, targetplayer.level);
                    if (minLineUser.propStates[1].getPropType != 2) {
                        //让青蛙眩晕
                        AIPropsMgr.getInstance().changeSinglePlayerState({ type: 8 }, minLineUser);
                        //变更服务器上青蛙位置避免一直触发碰撞
                        this.frogchangepoint(minLineUser, point2);
                        //获取tween动画方法
                        this.getflicktween(point2, minLineUser);
                    }
                    if (targetplayer.propStates[1].getPropType != 2) {
                        //让青蛙眩晕
                        AIPropsMgr.getInstance().changeSinglePlayerState({ type: 8 }, targetplayer);
                        //变更服务器上青蛙位置避免一直触发碰撞
                        this.frogchangepoint(targetplayer, point1);
                        //获取tween动画方法
                        this.getflicktween(point1, targetplayer);
                    }
                    return;
                }
                else {
                    var line = this.getOneLine(targetplayer.userId, minLineUser.userId);
                    if (line == null) {
                        //	console.log("dddddd" + targetplayer.otherLineUser);;
                        return;
                    }
                    line.userOneId = targetplayer.userId;
                    line.userTwoId = minLineUser.userId;
                    line.isUsed = true;
                    line.type = minLineUser.frogType;
                    line.uop = { x: targetplayer.x, y: targetplayer.y };
                    line.utp = { x: minLineUser.x, y: minLineUser.y };
                    //此处因为使用的是临时生成的玩家，所以改动没有意义，我们需要改动原始的数据。
                    targetplayer.ishadLine = true;
                    targetplayer.otherLineUser = line.userTwoId;
                    userTwo = this.userMgr.get(minLineUser.userId);
                    if (userTwo != null) {
                        userTwo.ishadLine = true;
                        userTwo.otherLineUser = line.userOneId;
                    }
                    minLineUser.ishadLine = true;
                    // console.log("创建一条线");
                    roomLine.push(line);
                    return;
                }
            }
        }
    };
    //+++++++++++++++linemgr++++++++++++++++//
    //如果玩家ishadline为true 但linedata中却不存在该玩家的线 把该玩家ishadline改为false
    LineManager.prototype.setIsHadLineFalse = function (room, user) {
        for (var _i = 0, _a = room.roomLine; _i < _a.length; _i++) {
            var line = _a[_i];
            if (line.userOneId == user.userId || line.userTwoId == user.userId) {
                return;
            }
        }
        user.ishadLine = false;
    };
    /**更改服务器上青蛙位置 */
    LineManager.prototype.frogchangepoint = function (targetplayer, point) {
        targetplayer.x = point.x;
        targetplayer.y = point.y;
    };
    LineManager.prototype.createLines = function () {
        this.totallinesPool = 0;
        if (this.c == null) {
            console.log('createLines fail!!!!config==null');
            return;
        }
        var numbers = this.c.maxUserCountByRoom * this.c.maxRoomCount * 2 - this.linesPool.length;
        if (numbers <= 0) {
            console.log('createLines fail!!!!num+numbers');
            return;
        }
        //console.log('创建线数目' + numbers);
        //遍历所有道具
        for (var i = 0; i < numbers; ++i) {
            this.createOneLine(i);
        }
    };
    /***初始化线 */
    LineManager.prototype.restLines = function () {
        this.cleanRoomLines();
    };
    /**创建一个线 */
    LineManager.prototype.createOneLine = function (index) {
        this.linesPool.push({
            userOneId: -1,
            userTwoId: -1,
            type: 0,
            id: index,
            isUsed: false
        });
        this.totallinesPool++;
    };
    /**
     * 检查连线
     * 我们来判断一下这些线是否仍然连接
     */
    LineManager.prototype.checkLinesAlive = function (linesPool) {
        for (var m = (linesPool.length - 1); m >= 0; m--) {
            //跳过未使用的线
            if (!linesPool[m].isUsed) {
                continue;
            }
            //判断线是否还存活，不存货则删除
            if (!this.isLineLiving(linesPool[m])) {
                this.recoveryLine(linesPool[m], linesPool);
            }
        }
    };
    LineManager.prototype.getLineInfo = function (line) {
        var lineInfo = { isalive: true, ptstart: { x: 0, y: 0 }, ptend: { x: 0, y: 0 } };
        if (line.userOneId < 0 || line.userTwoId < 0) {
            //	console.log("线断了， 一个青蛙UserID 《0");
            lineInfo.isalive = false;
            return lineInfo;
        }
        var userOneInfo = this.userMgr.get(line.userOneId);
        var userTwoInfo = this.userMgr.get(line.userTwoId);
        if (userOneInfo == null || userTwoInfo == null || userOneInfo.death.isDeath || userTwoInfo.death.isDeath) {
            //		console.log("线断了一个青蛙死了");
            lineInfo.isalive = false;
            return lineInfo;
        }
        if (userOneInfo.frogType != userTwoInfo.frogType) {
            //	console.log("线断了 青蛙类型不一样");
            lineInfo.isalive = false;
            return lineInfo;
        }
        if (this.util.getDistance({ x: userOneInfo.x, y: userOneInfo.y }, { x: userTwoInfo.x, y: userTwoInfo.y }) > (userOneInfo.lineLength + userTwoInfo.lineLength)) {
            //	console.log("线断了 第一个人位置" + userOneInfo.x + "|" + userOneInfo.y + "第二个人位置" + userTwoInfo.x + "|" + userTwoInfo.y + "当前距离" + this.util.getDistance({ x: userOneInfo.x, y: userOneInfo.y }, { x: userTwoInfo.x, y: userTwoInfo.y }) + "线长" + (userOneInfo.lineLength + userTwoInfo.lineLength));
            lineInfo.isalive = false;
            return lineInfo;
        }
        lineInfo.ptstart.x = userOneInfo.x;
        lineInfo.ptstart.y = userOneInfo.y;
        lineInfo.ptend.x = userTwoInfo.x;
        lineInfo.ptend.y = userTwoInfo.y;
        return lineInfo;
    };
    LineManager.prototype.isLineLiving = function (line) {
        if (line.userOneId < 0 || line.userTwoId < 0) {
            //	console.log("线断了， 一个听蛙UserID 《0");
            return false;
        }
        var userOneInfo = this.userMgr.get(line.userOneId);
        var userTwoInfo = this.userMgr.get(line.userTwoId);
        if (userOneInfo == null || userTwoInfo == null || userOneInfo.death.isDeath || userTwoInfo.death.isDeath) {
            //	console.log("线断了一个青蛙死了");
            return false;
        }
        // if (userOneInfo.propStates.getPropType == 3 || userTwoInfo.propStates.getPropType == 3) {
        // 	return false;
        // }
        if (userOneInfo.frogType != userTwoInfo.frogType) {
            // console.log("线断了 青蛙类型不一样");
            // console.log("frog name"+userOneInfo.name+"NAME2"+userTwoInfo.name+"11111111111111111")
            // console.log("666666666666666666666666666"+userOneInfo.name+userOneInfo.death.isDeath+"///////////"+userTwoInfo.name+userTwoInfo.death.isDeath)
            if (userOneInfo.disconnection_line_time != 1) {
                userOneInfo.disconnection_line = true;
                userOneInfo.disconnection_line_time = Date.now();
            }
            if (userTwoInfo.disconnection_line_time != 1) {
                userTwoInfo.disconnection_line = true;
                userTwoInfo.disconnection_line_time = Date.now();
            }
            return false;
        }
        // if (this.util.getDistance({ x: userOneInfo.x, y: userOneInfo.y }, { x: userTwoInfo.x, y: userTwoInfo.y }) > (userOneInfo.lineLength + userTwoInfo.lineLength)) {
        // 	//console.log("线断了 第一个人位置" + userOneInfo.x + "|" + userOneInfo.y + "第二个人位置" + userTwoInfo.x + "|" + userTwoInfo.y + "当前距离" + this.util.getDistance({ x: userOneInfo.x, y: userOneInfo.y }, { x: userTwoInfo.x, y: userTwoInfo.y }) + "线长" + (userOneInfo.lineLength + userTwoInfo.lineLength));
        // 	return this.lineLongerMax(userOneInfo, userTwoInfo);
        // }
        return true;
    };
    /**线超过最大长度 */
    LineManager.prototype.lineLongerMax = function (userOneInfo, userTwoInfo) {
        //return true;
        if (userOneInfo.disconnection_line_time != 1) {
            userOneInfo.disconnection_line = true;
            userOneInfo.disconnection_line_time = Date.now();
        }
        if (userTwoInfo.disconnection_line_time != 1) {
            userTwoInfo.disconnection_line = true;
            userTwoInfo.disconnection_line_time = Date.now();
        }
        return false;
    };
    LineManager.prototype.recoveryLine = function (line, roomLine) {
        if (roomLine == null) {
            //	console.log("逻辑炸弹 recoveryLine");
            return;
        }
        //清空玩家的状态
        var userOneInfo = this.userMgr.get(line.userOneId);
        if (userOneInfo != null) {
            userOneInfo.ishadLine = false;
            userOneInfo.otherLineUser = -1;
            userOneInfo.mistakeRate = 0;
        }
        var userTwoInfo = this.userMgr.get(line.userTwoId);
        if (userTwoInfo != null) {
            userTwoInfo.ishadLine = false;
            userTwoInfo.otherLineUser = -1;
            userTwoInfo.mistakeRate = 0;
        }
        //清空线的状态
        line.isUsed = false;
        line.userOneId = -1;
        line.userTwoId = -1;
        line.type = 0;
        //从房间的线库里面清楚掉这个线
        if (this.util.findIndex(roomLine, line.id) > -1)
            roomLine.splice(this.util.findIndex(roomLine, line.id), 1);
    };
    LineManager.prototype.getOneLine = function (useroneid, usertwoid) {
        //获取当前没有使用的道具
        for (var i = 0; i < this.linesPool.length; ++i) {
            if (!this.linesPool[i].isUsed) {
                this.linesPool[i].isUsed = true;
                return this.linesPool[i];
            }
            else {
                if (this.linesPool[i].userOneId == useroneid || this.linesPool[i].userTwoId == useroneid || this.linesPool[i].userOneId == usertwoid || this.linesPool[i].userTwoId == usertwoid) {
                    //	console.log("强制回收线");
                    return this.linesPool[i];
                }
            }
        }
        console.log("没有线了");
        //没有未使用的则再创建一个
        if (this.c.isproppoolext)
            return this.createExtOneLine();
        else
            return;
    };
    LineManager.prototype.createExtOneLine = function () {
        this.totallinesPool++;
        this.linesPool.push({
            userOneId: -1,
            userTwoId: -1,
            type: 0,
            id: this.totallinesPool,
            isUsed: false
        });
        return this.linesPool[this.totallinesPool - 1];
    };
    LineManager.prototype.cleanRoomLines = function () {
        for (var i = 0; i < this.linesPool.length; ++i) {
            this.linesPool[i].isUsed = false;
            this.linesPool[i].userOneId = -1;
            this.linesPool[i].userTwoId = -1;
            this.linesPool[i].type = 0;
        }
        AIServer.getInstance().roomInfo.roomLine = [];
    };
    LineManager.prototype.gettotallinesPool = function () {
        return this.totallinesPool;
    };
    LineManager.prototype.checkIsOnALine = function (something, usrend, usrstart) {
        /**点到线的距离 */
        var pointToLineLength = this.util.getPointToLineDistance(usrend, usrstart, something);
        return pointToLineLength < 50 ? true : false;
    };
    LineManager.prototype.checkLineIsOnALine = function (something, usrend, usrstart) {
        /**点到线的距离 */
        var pointToLineLength = this.util.getPointToLineDistance(usrend, usrstart, something);
        //  console.log("pointToLineLength="+pointToLineLength);
        return pointToLineLength < 50 ? true : false;
    };
    LineManager.prototype.getUserLine = function (lines, user) {
        if (lines == null || user == null)
            return null;
        for (var m = (lines.length - 1); m >= 0; m--) {
            //跳过未使用的线
            if (!lines[m].isUsed) {
                continue;
            }
            /**判断是否有玩家的线 */
            if (lines[m].userOneId == user.userId || lines[m].userTwoId == user.userId) {
                return lines[m];
            }
        }
        return null;
    };
    //如果玩家连线  从lineData中删除玩家所在的线
    LineManager.prototype.deleteLineFromPlayer = function (room, user) {
        if (!user.ishadLine)
            return;
        //获取线上另外一个玩家，将其的连线状态去除
        var id = user.userId;
        var index = null;
        for (var i = 0; i < room.roomLine.length; i++) {
            if (room.roomLine[i].userOneId == id || room.roomLine[i].userTwoId == id) {
                index = i;
                break;
            }
        }
        if (index != null) {
            var userOneInfo = this.userMgr.get(room.roomLine[index].userOneId);
            if (userOneInfo != null) {
                userOneInfo.ishadLine = false;
                userOneInfo.otherLineUser = -1;
                userOneInfo.mistakeRate = 0;
            }
            var userTwoInfo = this.userMgr.get(room.roomLine[index].userTwoId);
            if (userTwoInfo != null) {
                userTwoInfo.ishadLine = false;
                userTwoInfo.otherLineUser = -1;
                userTwoInfo.mistakeRate = 0;
            }
            room.roomLine.splice(index, 1);
        }
        else {
            user.ishadLine = false;
            console.log("玩家身上有线但在roomLine中没有找到对应的线");
        }
    };
    /**计算弹开距离 */
    LineManager.prototype.calulatePopDir1 = function (playOne, playerTwo) {
        this.calulateP0tmp.setTo(playOne.x, playOne.y);
        this.calulateP1tmp.setTo(playerTwo.x, playerTwo.y);
        var dir0 = this.calulateP0tmp.subtract(this.calulateP1tmp);
        dir0.normalize(60);
        var targePoint0 = this.calulateP0tmp.add(dir0);
        return targePoint0;
    };
    //private P1 = new egret.Point();
    /**计算弹开距离 */
    LineManager.prototype.calulatePopDir = function (playOne, playerTwo, playOneLv, playerTwoLv) {
        var P2 = this.P0.setTo(playOne.x, playOne.y);
        //let P3 = this.P1.setTo(playerTwo.x, playerTwo.y);
        //var dir0: any = P0.subtract(P1);
        var dir0 = this.calulatePopDirPoint.setTo(playOne.x - playerTwo.x, playOne.y - playerTwo.y);
        var lv = playOneLv - playerTwoLv;
        if (lv == 0) {
            //this.calulatePopDirPoint.normalize(60);
            dir0.normalize(60);
        }
        if (lv == 1) {
            //this.calulatePopDirPoint.normalize(50);
            dir0.normalize(50);
        }
        if (lv == 2) {
            //this.calulatePopDirPoint.normalize(40);.
            dir0.normalize(40);
        }
        if (lv == 3) {
            //this.calulatePopDirPoint.normalize(20);
            dir0.normalize(20);
        }
        if (lv == -1) {
            //this.calulatePopDirPoint.normalize(70);
            dir0.normalize(70);
        }
        if (lv == -2) {
            //this.calulatePopDirPoint.normalize(80);
            dir0.normalize(80);
        }
        if (lv == -3) {
            //this.calulatePopDirPoint.normalize(100);
            dir0.normalize(100);
        }
        //let targePoint0 =this.calulatePopDirPoint.setTo(this.calulatePopDirPoint.x + playOne.x, this.calulatePopDirPoint.y + playOne.y);
        //	let targePoint0 = P2.add(dir0);
        return { x: P2.x + dir0.x, y: P2.y + dir0.y };
    };
    /**获取弹开动画 */
    LineManager.prototype.getflicktween = function (point, player) {
        if (webNetworkMananger.getInstance().gameSceneRec != null) {
            if (webNetworkMananger.getInstance().gameSceneRec.m_createAllFrogs != null) {
                var frog = webNetworkMananger.getInstance().gameSceneRec.m_createAllFrogs.findFrogById(player.userId);
                if (frog != null) {
                    if (frog.tweenOver) {
                        if (player.isAI) {
                            frog.flicktweenAI(point);
                        }
                        else {
                            frog.flicktween(point);
                        }
                    }
                }
            }
        }
    };
    return LineManager;
}());
__reflect(LineManager.prototype, "LineManager");
var Util = (function () {
    function Util() {
        this.c = serverConfig.config;
    }
    Util.getInstance = function () {
        if (this.instance == null) {
            this.instance = new Util();
        }
        return this.instance;
    };
    Util.prototype.findIndex = function (arr, id) {
        var len = arr.length;
        while (len--) {
            if (arr[len].id === id) {
                return len;
            }
        }
        return -1;
    };
    Util.prototype.getDistance = function (startPoint, endPoint) {
        var x = Math.abs(endPoint.x - startPoint.x);
        var y = Math.abs(endPoint.y - startPoint.y);
        return Math.sqrt(x * x + y * y);
    };
    Util.prototype.getPointToLineDistance = function (p1, p2, p) {
        var ans = 0;
        var a = this.getPointDistance(p1, p2);
        var b = this.getPointDistance(p1, p);
        var c = this.getPointDistance(p2, p);
        if (c + b == a) {
            ans = 0;
            return ans;
        }
        if (a <= 0.00001) {
            ans = b;
            return ans;
        }
        if (c * c >= a * a + b * b) {
            ans = b;
            return ans;
        }
        if (b * b >= a * a + c * c) {
            ans = c;
            return ans;
        }
        // 组成锐角三角形，则求三角形的高
        var p0 = (a + b + c) / 2; // 半周长
        var s = Math.sqrt(p0 * (p0 - a) * (p0 - b) * (p0 - c)); // 海伦公式求面积
        ans = 2 * s / a; // 返回点到线的距离（利用三角形面积公式求高）
        return ans;
    };
    Util.prototype.getPointDistance = function (p, p1) {
        var dis_x = Math.abs(p.x - p1.x);
        var dis_y = Math.abs(p.y - p1.y);
        return Math.sqrt(Math.pow(dis_x, 2) + Math.pow(dis_y, 2));
    };
    Util.prototype.uniformPosition = function (points, radius) {
        var bestCandidate, maxDistance = 0;
        var numberOfCandidates = 10;
        if (points.length === 0) {
            return this.randomPosition(radius);
        }
        // Generate the candidates
        for (var ci = 0; ci < numberOfCandidates; ci++) {
            var minDistance = Infinity;
            var candidate = this.randomPosition(radius);
            candidate.radius = radius;
            for (var pi = 0; pi < points.length; pi++) {
                var distance = this.getDistance(candidate, points[pi]);
                if (distance < minDistance) {
                    minDistance = distance;
                }
            }
            if (minDistance > maxDistance) {
                bestCandidate = candidate;
                maxDistance = minDistance;
            }
            else {
                return this.randomPosition(radius);
            }
        }
        return bestCandidate;
    };
    Util.prototype.randomPosition = function (radius) {
        return {
            radius: 0,
            x: this.randomInRange(radius, this.c.gameWidth - radius),
            y: this.randomInRange(radius, this.c.gameHeight - radius)
        };
    };
    Util.prototype.randomInRange = function (from, to) {
        return Math.floor(Math.random() * (to - from)) + from;
    };
    Util.prototype.log = function () {
        var log = Math.log;
        return function (n, base) {
            return log(n) / (base ? log(base) : 1);
        };
    };
    Util.prototype.findIndexEx = function (arr, userId) {
        var len = arr.length;
        while (len--) {
            if (arr[len].userId === userId) {
                return len;
            }
        }
        return -1;
    };
    /**两点获取角度 */
    Util.prototype.getRotation = function (nowpos, topos) {
        if (nowpos == null) {
            return;
        }
        var px = nowpos.x;
        var py = nowpos.y;
        if (topos == null) {
            return;
        }
        var mx = topos.x;
        var my = topos.y;
        var x = Math.abs(px - mx);
        var y = Math.abs(py - my);
        var z = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
        var cos = y / z;
        var radina = Math.acos(cos); //用反三角函数求弧度
        var angle = 180 / (Math.PI / radina); //将弧度转换成角度
        if (mx > px && my > py) {
            angle = 180 - angle;
        }
        if (mx == px && my > py) {
            angle = 180;
        }
        if (mx > px && my == py) {
            angle = 90;
        }
        if (mx < px && my > py) {
            angle = 180 + angle;
        }
        if (mx < px && my == py) {
            angle = 270;
        }
        if (mx < px && my < py) {
            angle = 360 - angle;
        }
        return isNaN(angle) ? 0 : angle;
    };
    Util.prototype.getCenterPos = function (startPos, endPos) {
        return { x: (startPos.x + endPos.x) / 2, y: (startPos.y + endPos.y) / 2 };
    };
    /**
* 判断是否null data == "" ||
* @param data
*/
    Util.prototype.isNull = function (data) {
        return (data == undefined || data == null) ? true : false;
    };
    /**四点两线的交点 */
    Util.prototype.segmentsIntr = function (a, b, c, d) {
        /** 1 解线性方程组, 求线段交点. **/
        // 如果分母为0 则平行或共线, 不相交 
        var denominator = (b.y - a.y) * (d.x - c.x) - (a.x - b.x) * (c.y - d.y);
        if (denominator == 0) {
            return false;
        }
        // 线段所在直线的交点坐标 (x , y) 
        var x = ((b.x - a.x) * (d.x - c.x) * (c.y - a.y)
            + (b.y - a.y) * (d.x - c.x) * a.x
            - (d.y - c.y) * (b.x - a.x) * c.x) / denominator;
        var y = -((b.y - a.y) * (d.y - c.y) * (c.x - a.x)
            + (b.x - a.x) * (d.y - c.y) * a.y
            - (d.x - c.x) * (b.y - a.y) * c.y) / denominator;
        /** 2 判断交点是否在两条线段上 **/
        if (
        // 交点在线段1上 
        (x - a.x) * (x - b.x) <= 0 && (y - a.y) * (y - b.y) <= 0
            && (x - c.x) * (x - d.x) <= 0 && (y - c.y) * (y - d.y) <= 0) {
            // 返回交点p 
            return {
                x: x,
                y: y
            };
        }
        //否则不相交 
        return false;
    };
    //计算角度 起点到终点
    Util.prototype.calculateRotation = function (player_position, mouse_position) {
        var rotation = 0;
        var offestx = Math.abs(mouse_position.x - player_position.x);
        var offesty = Math.abs(mouse_position.y - player_position.y);
        var alpha = Math.atan(offestx / offesty);
        rotation = alpha * 180 / Math.PI;
        if (mouse_position.x - player_position.x > 0 && mouse_position.y - player_position.y > 0) {
            rotation = 180 - rotation;
        }
        else if (mouse_position.x - player_position.x > 0 && mouse_position.y - player_position.y < 0) {
            rotation = rotation;
        }
        else if (mouse_position.x - player_position.x < 0 && mouse_position.y - player_position.y < 0) {
            rotation = 360 - rotation;
        }
        else if (mouse_position.x - player_position.x < 0 && mouse_position.y - player_position.y > 0) {
            rotation = 180 + rotation;
        }
        //console.log(rotation);
        return rotation;
    };
    return Util;
}());
__reflect(Util.prototype, "Util");
//                            _ooOoo_  
//                           o8888888o  
//                           88" . "88  
//                           (| -_- |)  
//                            O\ = /O  
//                        ____/`---'\____  
//                        . ' \\| |// `.  
//                       / \\||| : |||// \  
//                     / _||||| -:- |||||- \  
//                       | | \\\ - /// | |  
//                     | \_| ''\---/'' |_|/ |
//                      \ .-\__ `-` ___/-. /  
//                   ___`. .' /--.--\ `. . __  
//                ."" '< `.___\_<|>_/___.' >'"".  
//               | | : `- \`.;`\ _ /`;.`/ - ` : | |  
//                 \ \ `-. \_ __\ /__ _/ .-` / /  
//         ======`-.____`-.___\_____/___.-`____.-'======  
//                            `=---='  
//  
//         .............................................  
//                  佛祖保佑             永无BUG 
/**AI 简单 */
var AI_base = (function () {
    function AI_base(userid) {
        this.setRandomMoveDirPoint = new egret.Point();
        this.calculateTargetPointTmp = new egret.Point(0, 0);
        this.haveSameTmpPoint = new egret.Point(0, 0);
        this.haveSameTmp2Point = new egret.Point(0, 0);
        this.DetectionPropsP0tmp = new egret.Point(0, 0);
        this.DetectionPropsP1tmp = new egret.Point(0, 0);
        this.DetectionPropsP2tmp = new egret.Point(0, 0);
        this.propDirection = new egret.Point(0, 0);
        this.detectLinetmpPoint = new egret.Point(0, 0);
        this.detectLinetmpPoint2 = new egret.Point(0, 0);
        this.detectLinetmpPoint3 = new egret.Point(0, 0);
        this.size = 50;
        this.states = 0;
        this.killNumber = 0;
        this.troops = -1;
        this.zhetime = 0;
        this.name = randomName.getInstance().getRandomName();
        this.userId = userid;
        this.roomId = -1;
        this.x = 0;
        this.y = 0;
        this.frogType = Math.floor(Math.random() * 2 + 0);
        this.level = 1;
        this.type = "player";
        this.lineLength = AIPropsMgr.getInstance().GetAttributesByGrade(0).frogLineLength;
        this.speed = serverConfig.config.initUserSpeed;
        this.radius = 5;
        this.isAI = true;
        this.ishadLine = false;
        this.otherLineUser = -1;
        this.lastHeartbeat = Date.now();
        this.socket = -1;
        this.grade = 0;
        this.tongueWide = AIPropsMgr.getInstance().GetAttributesByGrade(0).tongueWide;
        this.Error_probability = 20;
        this.Think_interval = 500;
        this.Think_time = 0;
        this.isUsed = false;
        this.Visual_scope = 500;
        //-------------------------------权重
        this.Avoid_weight = 100;
        this.Pursuit_weight = 200;
        this.Line_weight = 300;
        this.AddLine_weight = 200;
        this.RandomMove_weight = 50;
        this.Obstacle_weight = 50;
        this.prop_weight = 200;
        this.disconnection_line = false,
            this.disconnection_line_time = -1,
            this.propStates = [{
                    getPropType: -1,
                    PropStartTime: -1,
                }, {
                    getPropType: -1,
                    PropStartTime: -1,
                }, {
                    getPropType: -1,
                    PropStartTime: -1,
                }, {
                    getPropType: -1,
                    PropStartTime: -1,
                }, {
                    getPropType: -1,
                    PropStartTime: -1,
                }, {
                    getPropType: -1,
                    PropStartTime: -1,
                }, {
                    getPropType: -1,
                    PropStartTime: -1,
                }, {
                    getPropType: -1,
                    PropStartTime: -1,
                },
                {
                    getPropType: -1,
                    PropStartTime: -1,
                },],
            this.death = {
                isDeath: false,
                deadStartTime: 0
            };
        this.NewHandProtect = {
            isProtect: false,
            ProtectStartTime: 0
        };
        this.targetdir = new egret.Point();
        this.dressup = {
            decorateId: -1,
            trailingId: -1
        };
        this.shootStates =
            {
                shootStartTime: 0,
                isShoot: false,
                point: {
                    x: 0,
                    y: 0
                }
            };
        this.isCheckBreakLine = true;
        this.breakLineMin = 0;
        this.breakLineTimer = new egret.Timer(0, 0);
        this.isCanShoot = true;
        this.shootTimer = new egret.Timer(0, 0);
        this.changeColorTimer = new egret.Timer(6000, 1);
        this.enemyId = null;
        this.enemyTimer = new egret.Timer(4000, 1);
        this.My_position = new egret.Point(0, 0);
        this.Next_target = new egret.Point(0, 0);
    }
    /**检测是否断线
     * （连线玩家等级小于3级抽签并在3-10秒内断线）
     */
    AI_base.prototype.checkIsBreakLine = function () {
        if (!this.ishadLine) {
            if (this.breakLineTimer.running) {
                this.breakLineTimer.stop();
                this.breakLineTimer.removeEventListener(egret.TimerEvent.TIMER_COMPLETE, this.breakLine, this);
            }
            this.isCheckBreakLine = true;
            return;
        }
        if (!this.isCheckBreakLine) {
            return;
        }
        if (this.otherLineUser == null) {
            return;
        }
        /**跟自己连线的青蛙 */
        var lineFrog;
        if (this.otherLineUser == DataProl.account) {
            lineFrog = AIUserMgr.getInstance().currentPlayer;
        }
        else {
            lineFrog = serverAIMgr.getInstance().AIPools[this.otherLineUser];
        }
        if (lineFrog == null) {
            return;
        }
        this.isCheckBreakLine = false;
        if (lineFrog.level <= 3) {
            /**随机抽签 */
            var randomNum = Math.random() * 1;
            if (randomNum > 0.5) {
                /**随机断线时间3-10秒 */
                this.breakLineMin = Math.floor(Math.random() * 7000 + 3000);
                this.breakLineTimer = new egret.Timer(this.breakLineMin, 1);
                this.breakLineTimer.addEventListener(egret.TimerEvent.TIMER_COMPLETE, this.breakLine, this);
                this.enemyId = lineFrog.userId;
                this.breakLineTimer.start();
            }
        }
    };
    /**断线 */
    AI_base.prototype.breakLine = function () {
        this.breakLineTimer.stop();
        this.breakLineTimer.removeEventListener(egret.TimerEvent.TIMER_COMPLETE, this.breakLine, this);
        AIServer.getInstance().breakLine(this.userId);
        if (this.shootTimer.running) {
            this.shootTimer.reset();
        }
    };
    /**是否出错*/
    AI_base.prototype.isError = function () {
        var mistakeRate = Math.random() * 100;
        if (mistakeRate <= this.Error_probability) {
            return true;
        }
        else {
            return false;
        }
    };
    /**探测可视敌人 */
    AI_base.prototype.Detect_enemy = function () {
        /**除了自己的所有的可视玩家 */
        var Video_player = [];
        /**房间内所有玩家 */
        var All_player = AIServer.getInstance().roomInfo.roomUser;
        /**自己的坐标 */
        this.My_position.setTo(this.x, this.y);
        /**下一个点坐标 */
        for (var i = 0; i < All_player.length; i++) {
            // /**其他玩家坐标 */
            // let Player_position = new egret.Point(All_player[i].x, All_player[i].y);
            // /**自己与其它玩家的距离 */
            // let YouMe_distance = egret.Point.distance(this.My_position, Player_position);
            var YouMe_distance = MathUtils.distance(this.My_position.x, this.My_position.y, All_player[i].x, All_player[i].y);
            //判断进入可视范围；不是自己；不是自己连线的玩家
            if (this.Visual_scope > YouMe_distance && All_player[i].userId != this.userId && this.otherLineUser != All_player[i].userId) {
                Video_player.push(All_player[i]);
                //自己连线
                if (this.ishadLine) {
                    //目标连线
                    if (All_player[i].ishadLine) {
                        /**与自己连线的青蛙 */
                        var otherLineUser = void 0;
                        /**其他青蛙的连线青蛙*/
                        var frogLineUser = void 0;
                        if (this.otherLineUser == DataProl.account) {
                            otherLineUser = AIUserMgr.getInstance().currentPlayer;
                        }
                        else {
                            otherLineUser = serverAIMgr.getInstance().AIPools[this.otherLineUser];
                        }
                        if (All_player[i].otherLineUser == DataProl.account) {
                            frogLineUser = AIUserMgr.getInstance().currentPlayer;
                        }
                        else {
                            frogLineUser = serverAIMgr.getInstance().AIPools[All_player[i].otherLineUser];
                        }
                        var dis_o2m = MathUtils.getFootfallDistance(this.x, this.y, otherLineUser.x, otherLineUser.y, All_player[i].x, All_player[i].y);
                        var dis_m2o = MathUtils.getFootfallDistance(All_player[i].x, All_player[i].y, frogLineUser.x, frogLineUser.y, this.x, this.y);
                        var pt_o2m = MathUtils.getFootfallPoint(this.x, this.y, otherLineUser.x, otherLineUser.y, All_player[i].x, All_player[i].y);
                        var pt_m2o = MathUtils.getFootfallPoint(All_player[i].x, All_player[i].y, frogLineUser.x, frogLineUser.y, this.x, this.y);
                        /**pt_o2m在AIPools[i]线段内为true */
                        var on_line_o2m = MathUtils.checkPointOnSegment(this.x, this.y, otherLineUser.x, otherLineUser.y, pt_o2m.x, pt_o2m.y);
                        /** pt_m2o在frog线段内为true*/
                        var on_line_m2o = MathUtils.checkPointOnSegment(All_player[i].x, All_player[i].y, frogLineUser.x, frogLineUser.y, pt_m2o.x, pt_m2o.y);
                        if (on_line_o2m == false && on_line_m2o == true) {
                            if (dis_o2m < dis_m2o) {
                                this.Next_target.x = All_player[i].x - (this.x + otherLineUser.x) / 2;
                                this.Next_target.y = All_player[i].y - (this.y + otherLineUser.y) / 2;
                                this.Next_target.normalize(this.Pursuit_weight * (1 - YouMe_distance / this.Visual_scope));
                            }
                            else {
                                this.Next_target.x = -this.x - (All_player[i].x + frogLineUser.x) / 2;
                                this.Next_target.y = -this.y - (All_player[i].x + frogLineUser.x) / 2;
                                this.Next_target.normalize(this.Avoid_weight * (1 - YouMe_distance / this.Visual_scope));
                            }
                        }
                        else {
                            if (dis_o2m > dis_m2o) {
                                this.Next_target.x = All_player[i].x - (this.x + otherLineUser.x) / 2;
                                this.Next_target.y = All_player[i].y - (this.y + otherLineUser.y) / 2;
                                this.Next_target.normalize(this.Pursuit_weight * (1 - YouMe_distance / this.Visual_scope));
                            }
                            else {
                                this.Next_target.x = -this.x - (All_player[i].x + frogLineUser.x) / 2;
                                this.Next_target.y = -this.y - (All_player[i].x + frogLineUser.x) / 2;
                                this.Next_target.normalize(this.Avoid_weight * (1 - YouMe_distance / this.Visual_scope));
                            }
                        }
                    }
                    else {
                        if (this.otherLineUser == DataProl.account) {
                            this.Next_target.x = (All_player[i].x - (this.x + AIUserMgr.getInstance().currentPlayer.x) / 2);
                            this.Next_target.y = (All_player[i].y - (this.y + AIUserMgr.getInstance().currentPlayer.y) / 2);
                            this.Next_target.normalize(this.Pursuit_weight * (1 - YouMe_distance / this.Visual_scope));
                        }
                        else {
                            this.Next_target.x = (All_player[i].x - (this.x + serverAIMgr.getInstance().AIPools[this.otherLineUser].x) / 2);
                            this.Next_target.y = (All_player[i].y - (this.y + serverAIMgr.getInstance().AIPools[this.otherLineUser].y) / 2);
                            this.Next_target.normalize(this.Pursuit_weight * (1 - YouMe_distance / this.Visual_scope));
                        }
                    }
                }
                else {
                    //目标连线
                    if (All_player[i].ishadLine) {
                        var closest_prop = this.GetClosestProps(this.Visual_scope);
                        if (closest_prop != null) {
                            var dis_m2p = MathUtils.getFootfallDistance(All_player[i].x, All_player[i].y, AIUserMgr.getInstance().currentPlayer.x, AIUserMgr.getInstance().currentPlayer.y, this.x, this.y);
                            var dis_m2o = MathUtils.getFootfallDistance(All_player[i].x, All_player[i].y, AIUserMgr.getInstance().currentPlayer.x, AIUserMgr.getInstance().currentPlayer.y, closest_prop.x, closest_prop.y);
                            var pt_m2o = MathUtils.getFootfallPoint(All_player[i].x, All_player[i].y, AIUserMgr.getInstance().currentPlayer.x, AIUserMgr.getInstance().currentPlayer.y, closest_prop.x, closest_prop.y);
                            if (dis_m2o > dis_m2p) {
                                var target_pt = MathUtils.getOnePointOnLineAt(pt_m2o.x, pt_m2o.y, closest_prop.x, closest_prop.y, 2);
                                this.Next_target.x = target_pt.x - this.x;
                                this.Next_target.y = target_pt.y - this.y;
                                this.Next_target.normalize(this.Avoid_weight * (1 - YouMe_distance / this.Visual_scope));
                            }
                        }
                        else if (All_player[i].otherLineUser == DataProl.account) {
                            var dis_m2o = MathUtils.getFootfallDistance(All_player[i].x, All_player[i].y, AIUserMgr.getInstance().currentPlayer.x, AIUserMgr.getInstance().currentPlayer.y, this.x, this.y);
                            var pt_m2o = MathUtils.getFootfallPoint(All_player[i].x, All_player[i].y, AIUserMgr.getInstance().currentPlayer.x, AIUserMgr.getInstance().currentPlayer.y, this.x, this.y);
                            var on_line_m2o = MathUtils.checkPointOnSegment(All_player[i].x, All_player[i].y, AIUserMgr.getInstance().currentPlayer.x, AIUserMgr.getInstance().currentPlayer.y, pt_m2o.x, pt_m2o.y);
                            if (on_line_m2o) {
                                this.Next_target.x = this.x - pt_m2o.x;
                                this.Next_target.y = this.y - pt_m2o.y;
                                this.Next_target.normalize(this.Avoid_weight * (1 - YouMe_distance / this.Visual_scope));
                            }
                            else {
                                this.Next_target.x = (this.x - (All_player[i].x + AIUserMgr.getInstance().currentPlayer.x) / 2);
                                this.Next_target.y = (this.y - (All_player[i].y + AIUserMgr.getInstance().currentPlayer.y) / 2);
                                this.Next_target.normalize(this.Avoid_weight * (1 - YouMe_distance / this.Visual_scope));
                            }
                        }
                        else {
                            //	let dis_m2o = MathUtils.getFootfallDistance(frog.x, frog.y, serverAIMgr.getInstance().AIPools[frog.otherLineUser].x, serverAIMgr.getInstance().AIPools[frog.otherLineUser].y, this.x, this.y);
                            var pt_m2o = MathUtils.getFootfallPoint(All_player[i].x, All_player[i].y, serverAIMgr.getInstance().AIPools[All_player[i].otherLineUser].x, serverAIMgr.getInstance().AIPools[All_player[i].otherLineUser].y, this.x, this.y);
                            this.Next_target.x = this.x - pt_m2o.x;
                            this.Next_target.y = this.y - pt_m2o.y;
                            var on_line_m2o = MathUtils.checkPointOnSegment(All_player[i].x, All_player[i].y, serverAIMgr.getInstance().AIPools[All_player[i].otherLineUser].x, serverAIMgr.getInstance().AIPools[All_player[i].otherLineUser].y, pt_m2o.x, pt_m2o.y);
                            if (on_line_m2o) {
                                this.Next_target.x = this.x - pt_m2o.x;
                                this.Next_target.y = this.y - pt_m2o.y;
                                this.Next_target.normalize(this.Avoid_weight * (1 - YouMe_distance / this.Visual_scope));
                            }
                            else {
                                this.Next_target.x = (this.x - (All_player[i].x + AIUserMgr.getInstance().currentPlayer.x) / 2);
                                this.Next_target.y = (this.y - (All_player[i].y + AIUserMgr.getInstance().currentPlayer.y) / 2);
                                this.Next_target.normalize(this.Avoid_weight * (1 - YouMe_distance / this.Visual_scope));
                            }
                        }
                    }
                    else {
                        //如果颜色一样朝对方方向移动
                        if (this.frogType == All_player[i].frogType && this.enemyId != All_player[i].userId) {
                            this.Next_target.x = -this.x + All_player[i].x;
                            this.Next_target.y = -this.y + All_player[i].y;
                            this.Next_target.normalize(this.Pursuit_weight * (1 - YouMe_distance / this.Visual_scope));
                            if (YouMe_distance <= this.lineLength) {
                                this.shoot();
                            }
                        }
                    }
                }
                this.targetdir.offset(this.Next_target.x, this.Next_target.y);
            }
        }
        /**如果可视玩家为空 */
        if (Video_player.length == 0) {
            this.setRandomMoveDir();
        }
    };
    /**吐舌 */
    AI_base.prototype.shoot = function () {
        if (!this.isCanShoot) {
            return;
        }
        var frog = webNetworkMananger.getInstance().gameSceneRec.m_createAllFrogs.findFrogById(this.userId);
        if (frog == null) {
            return;
        }
        frog.loll();
        this.isCanShoot = false;
        if (this.shootTimer == null)
            this.shootTimer = new egret.Timer(4000, 1);
        this.shootTimer.addEventListener(egret.TimerEvent.TIMER_COMPLETE, this.restShoot, this);
        this.shootTimer.start();
    };
    /**重置吐舌 */
    AI_base.prototype.restShoot = function () {
        this.shootTimer.stop();
        this.shootTimer.removeEventListener(egret.TimerEvent.TIMER_COMPLETE, this.restShoot, this);
        this.isCanShoot = true;
    };
    /**随机移动 */
    AI_base.prototype.setRandomMoveDir = function () {
        var moveDir = MathUtils.getRandomDir();
        //	moveDir = new egret.Point(moveDir.x, moveDir.y);
        this.setRandomMoveDirPoint.setTo(moveDir.x, moveDir.y);
        var randomLust = Math.random();
        this.setRandomMoveDirPoint.normalize(this.RandomMove_weight * randomLust);
        this.targetdir.offset(this.setRandomMoveDirPoint.x, this.setRandomMoveDirPoint.y);
    };
    /**是否撞边界
     * 撞到false
    */
    AI_base.prototype.checkPointValid = function (point) {
        var isValid = true;
        if (point.x > 2450 || point.x < 50) {
            isValid = false;
        }
        if (point.y > 2440 || point.y < 65) {
            isValid = false;
        }
        return isValid;
    };
    /**判断下次位置是否撞墙 */
    AI_base.prototype.calculateTargetPoint = function () {
        var nextPoint = MathUtils.calculateNextPointEx(this.x, this.y, this.targetdir.x, this.targetdir.y, this.speed, false);
        if (!this.checkPointValid(nextPoint)) {
            this.calculateTargetPointTmp.setTo(-this.targetdir.x, -this.targetdir.y);
            this.calculateTargetPointTmp.normalize(this.Obstacle_weight);
            this.targetdir.offset(this.calculateTargetPointTmp.x, this.calculateTargetPointTmp.y);
        }
    };
    /**获取最近的玩家 */
    AI_base.prototype.GetClosestUser = function () {
    };
    /**获取最近的道具 */
    AI_base.prototype.GetClosestProps = function (disLimit) {
        var props = AIPropsMgr.getInstance().getRoomProps();
        var min_dis = 10000;
        var closest_prop;
        for (var j = 0; j < props.length; ++j) {
            var new_dis = MathUtils.distance(this.x, this.y, props[j].x, props[j].y);
            if (min_dis > new_dis) {
                min_dis = new_dis;
                closest_prop = props[j];
            }
        }
        if (min_dis > disLimit || closest_prop == undefined) {
            return null;
        }
        return closest_prop;
    };
    /**
     * AI 思考 移动
     */
    AI_base.prototype.AIUpdate = function () {
        if (this.partner != null) {
            this.targetdir.setTo(0, 0);
            return;
        }
        //如果AI存在则更新AI中的时间戳
        if (this.isUsed && !this.death.isDeath && this.userId != DataProl.account) {
            //获取时间
            var time = egret.getTimer();
            /**到达思考时间 */
            if (time - this.Think_time > this.Think_interval) {
                this.Think_interval = 500 + Math.floor(Math.random() * this.Think_interval);
                this.targetdir.setTo(0, 0);
                this.restChangeColorType();
                this.checkEnemy();
                this.Detect_line();
                this.checkIsBreakLine();
                this.DetectionProps();
                this.setRandomMoveDir();
                this.calculateTargetPoint();
                this.Detect_enemy();
                this.Think_time = time;
            }
        }
    };
    /**检测仇人 */
    AI_base.prototype.checkEnemy = function () {
        if (this.enemyId != null && !this.enemyTimer.running) {
            this.enemyTimer.addEventListener(egret.TimerEvent.TIMER_COMPLETE, this.restEnemy, this);
            this.enemyTimer.start();
        }
    };
    /**重置仇人 */
    AI_base.prototype.restEnemy = function () {
        this.enemyTimer.stop();
        this.enemyTimer.removeEventListener(egret.TimerEvent.TIMER_COMPLETE, this.restEnemy, this);
        this.enemyId = null;
    };
    /**重置变色状态 */
    AI_base.prototype.restChangeColorType = function () {
        for (var i = 0; i < this.propStates.length; i++) {
            if (this.propStates[i].getPropType == 5) {
                if (this.changeColorTimer.running) {
                    this.changeColorTimer.reset();
                }
                else {
                    this.changeColorTimer.start();
                }
            }
        }
    };
    /**判断可视范围是否有同色青蛙 */
    AI_base.prototype.haveSameFrogInMap = function () {
        /**房间内所有玩家 */
        var All_player = AIServer.getInstance().roomInfo.roomUser;
        /**自己的坐标 */
        this.haveSameTmpPoint.setTo(this.x, this.y);
        //	let My_position = new egret.Point(this.x, this.y);
        for (var i = 0; i < All_player.length; i++) {
            /**其他玩家坐标 */
            //	let Player_position = new egret.Point(All_player[i].x, All_player[i].y);
            this.haveSameTmp2Point.setTo(All_player[i].x, All_player[i].y);
            /**自己与其它玩家的距离 */
            var YouMe_distance = egret.Point.distance(this.haveSameTmpPoint, this.haveSameTmp2Point);
            //判断进入可视范围；不是自己；不是自己连线的玩家
            if (this.Visual_scope > YouMe_distance && All_player[i].userId != this.userId && this.otherLineUser != All_player[i].userId && All_player[i].frogType == this.frogType) {
                return true;
            }
        }
        return false;
    };
    /**探测道具 */
    AI_base.prototype.DetectionProps = function () {
        /**全部道具 */
        var props = AIPropsMgr.getInstance().getRoomProps();
        if (props == null) {
            return;
        }
        /**我的位置 */
        //	let myPoint = new egret.Point(this.x, this.y);
        this.DetectionPropsP0tmp.setTo(this.x, this.y);
        /**增益道具正方向
             * 减益道具反方向
            */
        //let propDirection: egret.Point;
        for (var i = 0; i < props.length; i++) {
            /**道具 */
            var prop_2 = props[i];
            /**道具位置 */
            this.DetectionPropsP1tmp.setTo(prop_2.x, prop_2.y);
            //	let propPoint = new egret.Point(prop.x, prop.y);
            /**我和道具的距离 */
            var propDistance = egret.Point.distance(this.DetectionPropsP0tmp, this.DetectionPropsP1tmp);
            //进入可视范围
            if (propDistance <= this.Visual_scope) {
                //变色道具
                if (prop_2.type == 5) {
                    if (this.haveSameFrogInMap() && !this.changeColorTimer.running) {
                        this.propDirection.setTo(this.DetectionPropsP1tmp.x - this.DetectionPropsP0tmp.x, this.DetectionPropsP1tmp.y - this.DetectionPropsP0tmp.y);
                        this.propDirection.normalize(this.prop_weight * (propDistance / this.Visual_scope));
                        this.targetdir.offset(this.propDirection.x, this.propDirection.y);
                        return;
                    }
                }
                //躲避减益道具
                if (prop_2.type == 4 || prop_2.type == 2) {
                    this.propDirection.setTo(this.DetectionPropsP0tmp.x - this.DetectionPropsP1tmp.x, this.DetectionPropsP0tmp.y - this.DetectionPropsP1tmp.y);
                    //	propDirection = this.DetectionPropsP0tmp.subtract(this.DetectionPropsP1tmp);
                    this.propDirection.normalize(this.prop_weight * (propDistance / this.Visual_scope));
                    this.targetdir.offset(this.propDirection.x, this.propDirection.y);
                    return;
                }
                //主动找荷叶道具
                if (prop_2.type == 6 || prop_2.type == 7) {
                    this.propDirection.setTo(this.DetectionPropsP1tmp.x - this.DetectionPropsP0tmp.x, this.DetectionPropsP1tmp.y - this.DetectionPropsP0tmp.y);
                    //	propDirection = this.DetectionPropsP1tmp.subtract(this.DetectionPropsP0tmp);
                    this.propDirection.normalize(this.prop_weight * (propDistance / this.Visual_scope));
                    this.targetdir.offset(this.propDirection.x, this.propDirection.y);
                    return;
                }
            }
        }
    };
    /**探测断线 */
    AI_base.prototype.Detect_line = function () {
        if (this.isError()) {
            return;
        }
        if (this.ishadLine) {
            /**所有玩家 */
            var All_player = serverAIMgr.getInstance().AIPools;
            /**自己下个点的坐标 */
            var MyNextPoint = MathUtils.calculateNextPointEx(this.x, this.y, this.targetdir.x, this.targetdir.y, this.speed, false);
            /**连线青蛙下个点的坐标 */
            var OtherNextPoint = void 0;
            /**最长线长 */
            var Max_line = void 0;
            if (this.otherLineUser == DataProl.account) {
                OtherNextPoint = MathUtils.calculateNextPointEx(AIUserMgr.getInstance().currentPlayer.x, AIUserMgr.getInstance().currentPlayer.y, AIUserMgr.getInstance().currentPlayer.targetdir.x, AIUserMgr.getInstance().currentPlayer.targetdir.y, AIUserMgr.getInstance().currentPlayer.speed, false);
                //Max_line = this.lineLength > AIUserMgr.getInstance().currentPlayer.lineLength ? this.lineLength : AIUserMgr.getInstance().currentPlayer.lineLength;
                Max_line = this.lineLength + AIUserMgr.getInstance().currentPlayer.lineLength;
            }
            else {
                OtherNextPoint = MathUtils.calculateNextPointEx(All_player[this.otherLineUser].x, All_player[this.otherLineUser].y, All_player[this.otherLineUser].targetdir.x, All_player[this.otherLineUser].targetdir.y, All_player[this.otherLineUser].speed, false);
                //Max_line = this.lineLength > All_player[this.otherLineUser].lineLength ? this.lineLength : All_player[this.otherLineUser].lineLength;
                Max_line = this.lineLength + All_player[this.otherLineUser].lineLength;
            }
            /**两只青蛙的距离 */
            var TwoForg_distance = MathUtils.distance(OtherNextPoint.x, OtherNextPoint.y, MyNextPoint.x, MyNextPoint.y);
            /**断线距离 */
            var Break_Line_distance = Max_line - TwoForg_distance;
            if (Break_Line_distance < (Max_line / 2)) {
                //	let offset_position = new egret.Point();
                this.detectLinetmpPoint.setTo(OtherNextPoint.x, OtherNextPoint.y);
                this.detectLinetmpPoint3.setTo(MyNextPoint.x, MyNextPoint.y);
                //offset_position = new egret.Point(MyNextPoint.x, MyNextPoint.y).subtract(new egret.Point(OtherNextPoint.x, OtherNextPoint.y));
                this.detectLinetmpPoint2.setTo(this.detectLinetmpPoint.x - this.detectLinetmpPoint3.x, this.detectLinetmpPoint.y - this.detectLinetmpPoint3.y);
                this.detectLinetmpPoint2.normalize(this.Line_weight * (1 - Break_Line_distance / Max_line));
                this.targetdir.offset(this.detectLinetmpPoint2.x, this.detectLinetmpPoint2.y);
            }
            else {
                this.detectLinetmpPoint.setTo(MyNextPoint.x, MyNextPoint.y);
                this.detectLinetmpPoint3.setTo(OtherNextPoint.x, OtherNextPoint.y);
                //offset_position = new egret.Point(MyNextPoint.x, MyNextPoint.y).subtract(new egret.Point(OtherNextPoint.x, OtherNextPoint.y));
                this.detectLinetmpPoint2.setTo(this.detectLinetmpPoint.x - this.detectLinetmpPoint3.x, this.detectLinetmpPoint.y - this.detectLinetmpPoint3.y);
                //	this.detectLinetmpPoint2 = this.detectLinetmpPoint.subtract(this.detectLinetmpPoint3);
                this.detectLinetmpPoint2.normalize(this.AddLine_weight * (1 - Break_Line_distance / Max_line));
                this.targetdir.offset(this.detectLinetmpPoint2.x, this.detectLinetmpPoint2.y);
            }
        }
        else {
            return;
        }
    };
    return AI_base;
}());
__reflect(AI_base.prototype, "AI_base");
/**
 * AI人物类
 */
var AIUserMgr = (function () {
    function AIUserMgr() {
        this.userList = new Array();
        this.userOnline = 0;
        this.c = serverConfig.config;
        /**用于重置玩家所有道具状态 */
        this.resetPlayerPropStates = function (player) {
            if (player == null) {
                console.log("重置玩家道具为空");
                return;
            }
            player.speed = this.c.initUserSpeed;
            player.NewHandProtect.isProtect = false;
            player.NewHandProtect.ProtectStartTime = 0;
            for (var i = 0; i < player.propStates.length; i++) {
                player.propStates[i].getPropType = 0;
                player.propStates[i].PropStartTime = 0;
            }
        };
        /**用于重置玩家单个道具状态 */
        this.resetPlayerOnePropStates = function (player, i) {
            if (player == null) {
                console.log("重置玩家道具为空");
                return;
            }
            if (i == 1 || i == 7) {
                player.speed = this.c.initUserSpeed;
            }
            // player.NewHandProtect.isProtect = false;
            // player.NewHandProtect.ProtectStartTime = 0;
            player.propStates[i].getPropType = 0;
            player.propStates[i].PropStartTime = 0;
            // for (var i = 0; i < player.propStates.length; i++) {
            // 	player.propStates[i].getPropType = 0;
            // 	player.propStates[i].PropStartTime = 0;
            // }
        };
    }
    AIUserMgr.getInstance = function () {
        if (this.instance == null) {
            this.instance = new AIUserMgr();
        }
        return this.instance;
    };
    /**创建一个玩家 */
    AIUserMgr.prototype.createPlayer = function (tuserId, name) {
        //var currentPlayer=new userBase();
        var currentPlayer = {
            troops: 1,
            /**杀敌数 */
            killNumber: 0,
            /**遮罩时间 */
            zhetime: 0,
            name: name,
            userId: tuserId,
            roomId: -1,
            x: 0,
            y: 0,
            frogType: Math.floor(Math.random() * 2 + 0),
            level: 1,
            type: "player",
            lastHeartbeat: Date.now(),
            lineLength: AIPropsMgr.getInstance().GetAttributesByGrade(0).frogLineLength,
            tongueWide: AIPropsMgr.getInstance().GetAttributesByGrade(0).tongueWide,
            grade: 0,
            speed: this.c.initUserSpeed,
            radius: 5,
            //表示玩家是否为AI
            isAI: false,
            //是否跟玩家连接
            ishadLine: false,
            //伙伴
            partner: -1,
            disconnection_line: false,
            disconnection_line_time: -1,
            /**是否吃到道具*/
            propStates: [{
                    getPropType: -1,
                    PropStartTime: -1,
                }, {
                    getPropType: -1,
                    PropStartTime: -1,
                }, {
                    getPropType: -1,
                    PropStartTime: -1,
                }, {
                    getPropType: -1,
                    PropStartTime: -1,
                }, {
                    getPropType: -1,
                    PropStartTime: -1,
                }, {
                    getPropType: -1,
                    PropStartTime: -1,
                }, {
                    getPropType: -1,
                    PropStartTime: -1,
                }, {
                    getPropType: -1,
                    PropStartTime: -1,
                },
                {
                    getPropType: -1,
                    PropStartTime: -1,
                }],
            //用于游戏房间来判断玩家是否死亡
            death: {
                isDeath: false,
                deadStartTime: 0
            },
            //判断玩家是否处于新手保护
            NewHandProtect: {
                isProtect: false,
                ProtectStartTime: 0
            },
            target: {
                x: 0,
                y: 0
            },
            targetdir: {
                x: 0,
                y: 0
            },
            dressup: {
                decorateId: -1,
                trailingId: -1
            },
            shootStates: {
                shootStartTime: 0,
                isShoot: false,
                point: {
                    x: 0,
                    y: 0
                }
            },
            size: 50,
            otherLineUser: -1,
            //0 normal,1 fly ,2 stun ,3 ice
            states: 0,
        };
        if (DataProl.tuanduizhan) {
            currentPlayer.frogType = currentPlayer.troops; //团队战自己是黄色
        }
        //console.log(tuserId + "创建成功...");
        this.userList[tuserId] = currentPlayer;
        this.currentPlayer = currentPlayer;
        this.userOnline++;
    };
    ;
    AIUserMgr.prototype.getAllUser = function () {
        return this.userList;
    };
    AIUserMgr.prototype.addAI = function (user) {
        this.userList[user.userId] = user;
    };
    ;
    AIUserMgr.prototype.del = function (userId) {
        delete this.userList[userId];
        this.userOnline--;
    };
    ;
    AIUserMgr.prototype.get = function (userId) {
        return this.userList[userId];
    };
    ;
    AIUserMgr.prototype.isOnline = function (userId) {
        var data = this.userList[userId];
        if (data != null) {
            return true;
        }
        return false;
    };
    ;
    AIUserMgr.prototype.getOnlineCount = function () {
        return this.userOnline;
    };
    AIUserMgr.prototype.kickOutPlayer = function (player) {
        var userList = AIServer.getInstance().roomInfo.roomUser;
        for (var t = 0; t < userList.length; t++) {
            if (userList[t].userId == player.userId) {
                userList.splice(t, 1);
                console.log("删除一个ai....");
            }
        }
    };
    /**初始化玩家们 */
    AIUserMgr.prototype.restUsers = function () {
        this.cleanRoomAis();
    };
    //将玩家从房间内提出
    AIUserMgr.prototype.kickUser = function (user) {
        if (user == null)
            return;
        if (user.isAI)
            return;
        this.del(user.userId);
        //this.kickOutPlayer(user);
        // if(socket!=null)
        //   socket.close()
    };
    ;
    AIUserMgr.prototype.cleanRoomAis = function () {
        this.currentPlayer.killNumber = 0;
        var mm = 100;
        for (var i = 0; i < this.userList.length; ++i) {
            if (this.userList[i] != null && this.userList[i] != undefined) {
                this.resetPlayer(this.userList[i], mm);
            }
        }
        AIServer.getInstance().roomInfo.roomUser = [];
    };
    /**给玩家设定一个保护罩 */
    AIUserMgr.prototype.setProtectShiled = function (player) {
        player.NewHandProtect.isProtect = true;
        player.NewHandProtect.ProtectStartTime = Date.now();
    };
    /**
     * 用于重置玩家的状态
     * @param {} roomId
     */
    AIUserMgr.prototype.resetPlayer = function (player, mm) {
        if (player == null) {
            console.log("重置玩家为空");
            return;
        }
        if (player.death != null) {
            player.death.isDeath = false;
            player.death.deadStartTime = null;
        }
        //      console.log("回收"+player.name);
        if (mm == 100) {
            player.killNumber = 0;
        }
        if (!DataProl.isXinShou) {
            player.grade = 0;
        }
        player.NewHandProtect.isProtect = false;
        player.NewHandProtect.ProtectStartTime = null;
        player.lineLength = AIPropsMgr.getInstance().GetAttributesByGrade(0).frogLineLength;
        player.tongueWide = AIPropsMgr.getInstance().GetAttributesByGrade(0).tongueWide;
        player.ishadLine = false;
        //团队战青蛙死亡不变色
        if (DataProl.tuanduizhan) {
            player.frogType = player.troops;
        }
        else {
            player.frogType = Math.floor(Math.random() * 2 + 0);
            if (DataProl.isXinShou) {
                player.frogType = 2;
            }
        }
        player.partner = null;
        player.otherLineUser = -1;
        player.disconnection_line = false;
        player.disconnection_line_time = 1;
        for (var i = 0; i < player.propStates.length; i++) {
            player.propStates[i].getPropType = 0;
            player.propStates[i].PropStartTime = 0;
        }
        player.dressup.decorateId = -1;
        player.dressup.trailingId = -1;
        player.speed = this.c.initUserSpeed;
        player.states = 0;
        player.x = player.y = 0;
        player.targetdir.x = player.targetdir.y = 0;
        player.name = randomName.getInstance().getRandomName();
    };
    return AIUserMgr;
}());
__reflect(AIUserMgr.prototype, "AIUserMgr");
/**
 * 服务器AI管理
 */
var serverAIMgr = (function () {
    function serverAIMgr() {
        /**AI池子 */
        this.AIPools = [];
        /**AI数量 */
        this.totalAIPool = 0;
        /**玩家管理 */
        this.userMgr = AIUserMgr.getInstance();
        this.c = serverConfig.config;
        /**
         * 用来清空AI的状态
         * @param {*} number
         */
        this.resetAI = function (player) {
            if (player != null) {
                if (!player.isAI) {
                    console.log("resetAI 玩家不是AI");
                    return;
                }
                else {
                    this.AIPools[player.userId].isUsed = false;
                    this.AIPools[player.userId].roomId = -1;
                    this.AIPools[player.userId].otherLineUser = -1;
                    this.AIPools[player.userId].speed = this.c.initUserSpeed;
                    player.roomId = -1;
                    this.userMgr.resetPlayer(player);
                }
            }
            else {
                console.log("resetAI 玩家不存在");
            }
        };
    }
    serverAIMgr.getInstance = function () {
        if (this.instance == null) {
            this.instance = new serverAIMgr();
        }
        return this.instance;
    };
    /**制造AI */
    serverAIMgr.prototype.creatAIs = function (number) {
        if (this.AIPools.length >= number)
            return;
        number -= this.AIPools.length;
        for (var i = 0; i < number; i++) {
            this.createAI(i);
        }
    };
    /**遍历所有AI初始化 */
    serverAIMgr.prototype.cleanRoomAI = function () {
        for (var i = 0; i < this.AIPools.length; ++i) {
            this.resetAI(this.AIPools[i]);
        }
    };
    /**初始化AI入口 */
    serverAIMgr.prototype.restAIs = function () {
        this.cleanRoomAI();
    };
    /**
     * 创建一个ai
     */
    serverAIMgr.prototype.createAI = function (tuserId) {
        var currentPlayer;
        var who = Math.floor(Math.random() * 3);
        who = 0;
        switch (who) {
            case 0:
                currentPlayer = new AI_base(tuserId);
                break;
            default:
                break;
        }
        this.AIPools[tuserId] = currentPlayer;
        AIUserMgr.getInstance().addAI(currentPlayer);
        //console.log("创建AI成功");
        this.totalAIPool++;
    };
    /**获取AI */
    serverAIMgr.prototype.getAI = function () {
        //获取当前没有使用的AI
        for (var i = 0; i < this.AIPools.length; ++i) {
            if (!this.AIPools[i].isUsed) {
                this.resetAI(this.AIPools[i]);
                this.AIPools[i].isUsed = true;
                return this.AIPools[i];
            }
            else {
                // console.log("已经使用过的AI"+i);
            }
        }
    };
    /**
     * AI 思考 移动
     */
    serverAIMgr.prototype.AIUpdate = function () {
        for (var i = 0; i < this.AIPools.length; ++i) {
            this.AIPools[i].AIUpdate();
        }
    };
    /**获取AI数量 */
    serverAIMgr.prototype.gettotalAIPools = function () {
        return this.totalAIPool;
    };
    ;
    return serverAIMgr;
}());
__reflect(serverAIMgr.prototype, "serverAIMgr");
/**青蛙眼睛管理类 */
var FaceManager = (function () {
    function FaceManager() {
        /**左眼资源组 */
        this.leftEyesRess = [];
        /**右眼资源组 */
        this.rightEyesRess = [];
        /**构造 */
        this.isFour = false;
        this.GetEyesRes();
    }
    /**获取单例对象 */
    FaceManager.GetInstance = function () {
        if (this.instance == null) {
            this.instance = new FaceManager();
        }
        return this.instance;
    };
    /**获取眼睛图片资源 */
    FaceManager.prototype.GetEyesRes = function () {
        for (var i = 0; i < 11; i++) {
            var texture = resManager.getInstance().getResGroups(i);
            if (i < 5) {
                this.rightEyesRess.push(texture);
            }
            else {
                if (i == 10) {
                    this.rightEyesRess.push(texture);
                    this.leftEyesRess.push(texture);
                }
                else {
                    this.leftEyesRess.push(texture);
                }
            }
        }
        console.log("眼睛资源加载完毕");
    };
    /**更换眼睛资源
     * @param user 青蛙显示对象
     * @param type 眼睛状态
     * @param leftEye 左眼位图
     * @param rightEye 右眼位图
     */
    //快断线眼
    FaceManager.prototype.ChangeWinkEyes = function (user, leftEye, rightEye) {
        if (user == null || leftEye == null || rightEye == null) {
            return;
        }
        this.ChangeOneEye(user, leftEye, this.leftEyesRess[0], "zuoyan");
        this.ChangeOneEye(user, rightEye, this.rightEyesRess[0], "youyan");
        console.log(user);
    };
    //正常眼
    FaceManager.prototype.ChangeNormalEyes = function (user, leftEye, rightEye) {
        if (user == null || leftEye == null || rightEye == null) {
            return;
        }
        this.ChangeOneEye(user, leftEye, this.leftEyesRess[1], "zuoyan");
        this.ChangeOneEye(user, rightEye, this.rightEyesRess[1], "youyan");
        console.log(user);
    };
    //红心眼
    FaceManager.prototype.ChangeHeartEyes = function (user, leftEye, rightEye) {
        if (user == null || leftEye == null || rightEye == null) {
            return;
        }
        this.ChangeOneEye(user, leftEye, this.leftEyesRess[2], "zuoyan");
        this.ChangeOneEye(user, rightEye, this.rightEyesRess[2], "youyan");
        console.log(user);
    };
    //断线眼
    FaceManager.prototype.ChangeCryEyes = function (user, leftEye, rightEye) {
        if (user == null || leftEye == null || rightEye == null) {
            return;
        }
        this.ChangeOneEye(user, leftEye, this.leftEyesRess[3], "zuoyan");
        this.ChangeOneEye(user, rightEye, this.rightEyesRess[3], "youyan");
        console.log(user);
    };
    //眩晕眼
    FaceManager.prototype.ChangeDizzinessEyes = function (user, leftEye, rightEye) {
        if (user == null || leftEye == null || rightEye == null) {
            return;
        }
        this.ChangeOneEye(user, leftEye, this.leftEyesRess[4], "zuoyan");
        this.ChangeOneEye(user, rightEye, this.rightEyesRess[4], "youyan");
        console.log(user);
    };
    //异色眼
    FaceManager.prototype.ChangeAwkardEyes = function (user, leftEye, rightEye) {
        if (user == null || leftEye == null || rightEye == null) {
            return;
        }
        this.ChangeOneEye(user, leftEye, this.leftEyesRess[5], "zuoyan");
        this.ChangeOneEye(user, rightEye, this.rightEyesRess[5], "youyan");
        console.log(user);
    };
    /**更换单个眼睛
     * @param user 青蛙显示对象
     * @param eyeBitmap 眼睛位图
     * @param texture 要更换的图片资源
     * @param slotName 插槽名字
     * @param type 眼睛状态
     */
    FaceManager.prototype.ChangeOneEye = function (user, eyeBitmap, texture, slotName) {
        //++type;
        var armature = user.armature;
        var slot = armature.getSlot(slotName);
        //slot.display.visible = false;
        eyeBitmap.texture = texture;
        eyeBitmap.width = 77;
        eyeBitmap.height = 77;
        eyeBitmap.x = slot.display.x;
        eyeBitmap.y = slot.display.y;
        eyeBitmap.anchorOffsetX = eyeBitmap.width / 2;
        eyeBitmap.anchorOffsetY = eyeBitmap.height / 2;
        slot.display = eyeBitmap;
        //眩晕
        // if (this.rightEyesRess[4]) {
        // 	// egret.Tween.get(eyeBitmap).to({ rotation: eyeBitmap.rotation + 5760 }, serverConfig.config.propBuffReationTime.dizzy * 10);
        // 	egret.Tween.get(eyeBitmap).to({ rotation: eyeBitmap.rotation + 3600 }, serverConfig.config.propBuffReationTime.dizzy * 10);
        // }
        // else {
        // 	egret.Tween.removeTweens(eyeBitmap);
        // 	eyeBitmap.rotation = 0;
        // }
    };
    return FaceManager;
}());
__reflect(FaceManager.prototype, "FaceManager");
//////////////////////////////////////////////////////////////////////////////////////
//
//  Copyright (c) 2014-present, Egret Technology.
//  All rights reserved.
//  Redistribution and use in source and binary forms, with or without
//  modification, are permitted provided that the following conditions are met:
//
//     * Redistributions of source code must retain the above copyright
//       notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above copyright
//       notice, this list of conditions and the following disclaimer in the
//       documentation and/or other materials provided with the distribution.
//     * Neither the name of the Egret nor the
//       names of its contributors may be used to endorse or promote products
//       derived from this software without specific prior written permission.
//
//  THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
//  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
//  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
//  IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
//  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
//  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
//  OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
//  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
//  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
//  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////////////
var AssetAdapter = (function () {
    function AssetAdapter() {
    }
    /**
     * @language zh_CN
     * 解析素材
     * @param source 待解析的新素材标识符
     * @param compFunc 解析完成回调函数，示例：callBack(content:any,source:string):void;
     * @param thisObject callBack的 this 引用
     */
    AssetAdapter.prototype.getAsset = function (source, compFunc, thisObject) {
        function onGetRes(data) {
            compFunc.call(thisObject, data, source);
        }
        if (RES.hasRes(source)) {
            var data = RES.getRes(source);
            if (data) {
                onGetRes(data);
            }
            else {
                RES.getResAsync(source, onGetRes, this);
            }
        }
        else {
            RES.getResByUrl(source, onGetRes, this, RES.ResourceItem.TYPE_IMAGE);
        }
    };
    return AssetAdapter;
}());
__reflect(AssetAdapter.prototype, "AssetAdapter", ["eui.IAssetAdapter"]);
/**青蛙配置文件 */
var frogConfig = (function () {
    function frogConfig() {
    }
    /**舌长系数 */
    frogConfig.Long_tongue_coefficient = 2.6;
    /**舌宽系数 */
    frogConfig.Tongue_width_coefficient = 1.7;
    /**独立舌长系数 */
    frogConfig.independent_Long_tongue_coefficient = 0.9;
    return frogConfig;
}());
__reflect(frogConfig.prototype, "frogConfig");
//青蛙管理类
//1.生成青蛙缓存池子
//2.给所有的青蛙设置目标点
//3.更新所有的青蛙
var frogMgr = (function (_super) {
    __extends(frogMgr, _super);
    function frogMgr(game) {
        var _this = _super.call(this) || this;
        /**玩家类型 */
        _this.clothes_List = ["lv", "huang", "qing"];
        /**本地地图上所有青蛙 */
        _this.frogListByClient = [];
        /**服务器地图上所有青蛙 */
        _this.frogListByServer = [];
        /**判断一下青蛙最大的数量 */
        _this.maxFogNumbers = 20;
        _this.tmpFrogCounterPoint = new egret.Point(0, 0);
        _this.gameHandle = game;
        _this.displayContainer = _this.gameHandle.gameFrog;
        return _this;
    }
    /**创建青蛙缓存 */
    frogMgr.prototype.createAllFrogs = function () {
        this.frogListByClient = [];
        this.m_lineMgr = this.gameHandle.tongueManager;
        for (var i = 0; i < this.maxFogNumbers; i++) {
            var frog = new control.frog(this);
            frog.init(i);
            this.frogListByClient.push(frog);
        }
    };
    /**创建联网青蛙缓存 */
    frogMgr.prototype.createAllNetFrogs = function () {
        //this.m_lineMgr = this.gameHandle.m_creatAllLine;
        this.frogListByClient = [];
        this.m_lineMgr = this.gameHandle.tongueManager;
        for (var i = 0; i < this.maxFogNumbers; i++) {
            var frog = new control.frogNet(this);
            frog.init(i);
            this.frogListByClient.push(frog);
        }
    };
    /**清楚所有联网青蛙状态 */
    frogMgr.prototype.resetAllNetForgs = function () {
        var frog = null;
        for (var _i = 0, _a = this.frogListByClient; _i < _a.length; _i++) {
            var e = _a[_i];
            e.reset();
        }
    };
    /**青蛙反作用力 */
    frogMgr.prototype.frogCounterforce = function (data) {
        var userid = data.account;
        this.tmpFrogCounterPoint.setTo(data.x, data.y);
        for (var _i = 0, _a = this.frogListByClient; _i < _a.length; _i++) {
            var frog = _a[_i];
            if (frog.userid == userid) {
                if (frog.userid == DataProl.account) {
                    frog.flicktween(this.tmpFrogCounterPoint);
                }
                else {
                    frog.flicktween(this.tmpFrogCounterPoint);
                }
            }
        }
    };
    /**青蛙碰撞反作用力 */
    frogMgr.prototype.frogFlick = function (data) {
        var userid = data.account;
        var Counterforce_point = new egret.Point(data.x, data.y);
        for (var _i = 0, _a = this.frogListByClient; _i < _a.length; _i++) {
            var frog = _a[_i];
            if (frog.userid == userid) {
                frog.flicktween(Counterforce_point);
            }
        }
    };
    /**获取连线玩家Id*/
    frogMgr.prototype.getLigatureUserId = function (userID) {
        var allLine = this.m_lineMgr.nowServerAllLine;
        var returnId = null;
        if (allLine == null)
            return;
        for (var t = 0; t < allLine.length; t++) {
            if (userID == allLine[t].userOneId)
                returnId = allLine[t].userTwoId;
            if (userID == allLine[t].userTwoId)
                returnId = allLine[t].userOneId;
        }
        if (returnId != null)
            return returnId;
    };
    /**获取我自己 */
    frogMgr.prototype.getMyFrog = function (userid, name, x, y, frogType, levle, dressup) {
        var _this = this;
        this.frogListByClient.forEach(function (e) {
            if (e.userid == userid) {
                e.reset();
                e.born(userid, name, x, y, frogType, levle, dressup);
                _this.gameHandle.myUser.userSprit = e;
                return;
            }
        });
        this.createUserFrog(userid, name, x, y, frogType, levle, dressup);
        this.frogListByClient.forEach(function (e) {
            if (e.userid == userid) {
                _this.gameHandle.myUser.userSprit = e;
            }
        });
    };
    /**通过ID查找青蛙 */
    frogMgr.prototype.findFrogById = function (userid) {
        var frog = null;
        for (var _i = 0, _a = this.frogListByClient; _i < _a.length; _i++) {
            var e = _a[_i];
            if (e.userid == userid && e.isUsed) {
                frog = e;
                break;
            }
        }
        return frog;
    };
    /**缓存池获取一只青蛙 */
    frogMgr.prototype.getOneFrog = function () {
        for (var _i = 0, _a = this.frogListByClient; _i < _a.length; _i++) {
            var frog = _a[_i];
            if (frog.isUsed == false) {
                frog.reset();
                return frog;
            }
        }
        return null;
    };
    /**更新青蛙转向 */
    frogMgr.prototype.updateVeer = function () {
        for (var _i = 0, _a = this.frogListByClient; _i < _a.length; _i++) {
            var frog = _a[_i];
            if (frog.isUsed != false) {
                frog.frogVeer();
            }
        }
    };
    /**青蛙伸舌 */
    frogMgr.prototype.frogLoll = function () {
        for (var _i = 0, _a = this.frogListByClient; _i < _a.length; _i++) {
            var frog = _a[_i];
            if (frog.userid == DataProl.account) {
                if (frog.frogIsHadLine) {
                    return;
                }
                else {
                    frog.loll();
                }
            }
        }
    };
    /**广播伸舌 */
    frogMgr.prototype.showShoot = function (user) {
        for (var _i = 0, _a = this.frogListByClient; _i < _a.length; _i++) {
            var frog = _a[_i];
            if (frog.userid == user.account) {
                frog.loll();
            }
        }
    };
    /**广播舔到道具动画 */
    frogMgr.prototype.tweenshoot = function (user) {
        for (var _i = 0, _a = this.frogListByClient; _i < _a.length; _i++) {
            var frog = _a[_i];
            if (frog.userid == user.account) {
                if (user.shootObjStates == 1) {
                    if (user.x != null && user.y != null) {
                        //广播舔到物品动画
                        frog.lickProp(user.x, user.y);
                    }
                }
            }
        }
    };
    /**检测玩家是否连线 */
    frogMgr.prototype.checkPlayerIsLine = function () {
        for (var _i = 0, _a = this.frogListByClient; _i < _a.length; _i++) {
            var frog = _a[_i];
            if (frog.userid == DataProl.account) {
                if (frog.frogIsHadLine) {
                    return true;
                }
                else {
                    return false;
                }
            }
        }
        return false;
    };
    // /**检测玩家是否可以连线 */
    // public checkPlayerCanLine() {
    // 	let player;
    // 	//找到自己的青蛙
    // 	for (var frog of this.frogListByClient) {
    // 		if (frog.userid == DataProl.account) {
    // 			if (!frog.frogIsHadLine) {
    // 				player = frog;
    // 			}
    // 		}
    // 	}
    // 	if (player == null || player == undefined) {
    // 		return false;
    // 	}
    // 	for (var frog of this.frogListByClient) {
    // 		if (!frog.frogIsHadLine && frog.type == player.type && frog.userid != DataProl.account) {
    // 			let distance = egret.Point.distance(new egret.Point(player.x, player.y), new egret.Point(frog.x, frog.y));
    // 			if (distance <= (player.frogLineLength + frog.frogLineLength)) {
    // 				return true;
    // 			}
    // 		}
    // 	}
    // 	return false;
    // }
    /**创建玩家青蛙 */
    frogMgr.prototype.createUserFrog = function (userid, name, x, y, frogType, levle, dressup) {
        var forg = this.getOneFrog();
        if (forg != null) {
            forg.born(userid, name, x, y, frogType, levle, dressup);
            //console.log("重置青蛙成功" + userid + ".." + x);
        }
    };
    /**创建AI属于的青蛙 */
    frogMgr.prototype.createAIFrog = function (userid, x, y, frogType, levle) {
        var forg = this.getOneFrog();
        if (forg != null) {
            forg.born(userid, userid, x, y, frogType, levle, DataProl.userCurrentDressUp);
            //console.log("重置青蛙成功" + userid + ".." + x);
        }
        return forg;
    };
    /**
     * 处理房间玩家消息
     * 1.判断本地有的，从data中清楚，让他们继续移动
     * 2.本地没有的新建
     * 3.本地有服务器没有删除（未完）
     */
    frogMgr.prototype.disposeRoomUserMessage = function (userData) {
        for (var t = 0; t < userData.length; t++) {
            /**一个玩家的信息 */
            var e = userData[t];
            //如果是自己
            if (e.userId == DataProl.account) {
                this.gameHandle.displaMyInfo(e);
            }
            /**判断用户是否存在 */
            var isHad = this.checkUesdFrogs(e);
            //如果不存在新建,存在继续移动
            if (!isHad) {
                if (e.userId != DataProl.account) {
                    this.createUserFrog(e.userId, e.name, e.x, e.y, e.frogType, e.level, e.dressup);
                }
                else {
                    this.createUserFrog(e.userId, DataProl.login_data.nickName, e.x, e.y, e.frogType, e.level, e.dressup);
                    serverConfig.config.SingleMobile = 1;
                }
            }
            else {
                if (serverConfig.config.shadowFrog == 1 && e.userId == DataProl.account) {
                    serverConfig.config.shadowFrog = 0;
                    var shadowFrog = this.findFrogById(DataProl.shadowFrogId);
                    if (shadowFrog != null) {
                        shadowFrog.x = e.x;
                        shadowFrog.y = e.y;
                        shadowFrog.targetPoint.x = e.x;
                        shadowFrog.targetPoint.y = e.y;
                    }
                }
            }
        }
        this.checkUserShow(userData);
    };
    /**检测用户是否在显示范围 */
    frogMgr.prototype.checkUserShow = function (userData) {
        for (var i = 0; i < this.frogListByClient.length; i++) {
            var isShow = false;
            for (var j = 0; j < userData.length; j++) {
                if (webNetworkMananger.isServerMove) {
                    if (this.frogListByClient[i].userid == userData[j].userId && !userData[j].Death.isDeath) {
                        isShow = true;
                        break;
                    }
                }
                else {
                    if (this.frogListByClient[i].userid == userData[j].userId && !userData[j].death.isDeath) {
                        isShow = true;
                        this.frogListByClient[i].setInRange(userData[j].isInRange);
                        break;
                    }
                }
            }
            if (!isShow) {
                if (this.frogListByClient[i].userid == DataProl.shadowFrogId) {
                    continue;
                }
                this.frogListByClient[i].frogDied();
            }
        }
    };
    /**检测用户是否存在地图上 */
    frogMgr.prototype.checkUesdFrogs = function (e) {
        for (var i = 0; i < this.frogListByClient.length; i++) {
            //跳过死青蛙
            if (this.frogListByClient[i].userid == -1 || this.frogListByClient[i].isUsed == false)
                continue;
            //如果存在调其updata方法
            if (this.frogListByClient[i].userid == e.userId) {
                this.frogListByClient[i].dataUpdata(e);
                return true;
            }
        }
        serverConfig.config.SingleMobile = 1;
        return false;
    };
    return frogMgr;
}(eui.Component));
__reflect(frogMgr.prototype, "frogMgr");
//青蛙类
//1.生成青蛙
//2.更换青蛙的皮肤和动画
//3.更新青蛙的动画，朝向和移动位置
//4.更改为网络青蛙，更改移动模式
var control;
(function (control) {
    var frogNet = (function (_super) {
        __extends(frogNet, _super);
        function frogNet(Game) {
            var _this = _super.call(this, Game) || this;
            /**断线惩罚 */
            _this.ispunish = false;
            /**是有颜色 */
            _this.iscolour = true;
            /**表情持续时间 */
            _this.eyetime = -1;
            /**墨镜持续时间 */
            _this.eyetimeMojing = -1;
            /**青蛙眼睛 */
            _this.qineyer = 1;
            /**判断玩家升级所需的值 */
            _this.frogUpdatePeroidValue = 100;
            /**青蛙舌长 */
            _this.frogLineLength = 0;
            /**线快断掉了 */
            _this.tu = new eui.Image();
            /**护盾外 */
            _this.shieldOuter = new eui.Image();
            /**护盾内 */
            _this.shieldInside = new eui.Image();
            /**玩家装饰 */
            _this.shipin = new eui.Image();
            _this.shipin_1 = new eui.Image();
            _this.shipin_2 = new eui.Image();
            _this.shipin_3 = new eui.Image();
            _this.shipin_4 = new eui.Image();
            _this.shipin_5 = new eui.Image();
            /**击杀表情 */
            _this.shipin1 = new eui.Image();
            /**粒子层 */
            _this.tralingLayer = new egret.Sprite();
            /**道具效果 */
            _this.effectOfProps = new eui.Image();
            /**连杀数 */
            _this.killNum = 0;
            /**帧动画层 */
            _this.ClipLayer = new egret.Sprite();
            /**青蛙身上出现冰块图片*/
            _this.ice2 = new eui.Image();
            /** 舔到异色青蛙眼睛两边变化-头上的黑线*/
            _this.heixian = new eui.Image();
            /** 舔到异色青蛙眼睛两边变化-头顶的汗*/
            _this.han = new eui.Image();
            /** 舔到异色青蛙眼睛内变化*/
            _this.eyeLeft = new eui.Image();
            /** 舔到异色青蛙眼睛内变化-右眼*/
            _this.eyeRight = new eui.Image();
            /** 舔到异色青蛙眼睛内变化-tween动画的变化*/
            _this.eyeLR = new eui.Image();
            /**显示道具效果-状态图片 */
            _this.zhuangtai_1 = new eui.Image();
            /**添加碰撞是左右两侧的波纹(bowen)-右侧 */
            _this.bwRight = new egret.Bitmap();
            /**添加碰撞是左右两侧的波纹(bowen) -左侧*/
            _this.bwLeft = new egret.Bitmap();
            /**判断青蛙的速度*/
            _this.distanceMax = 1;
            _this.isborn = false;
            _this.speed = 5;
            _this.ismoving = false;
            /**是否可以移动 */
            _this.canMove = true;
            /**当前道具效果  防止一直加载 */
            _this.nowPropsType = [-1, -1, -1, -1, -1, -1, -1, -1, -1];
            /**帧动画数组 */
            _this.Clip_shuzu = new Array();
            /**眩晕次数 */
            _this.xuanyunTime = 0;
            /**变色次数 */
            _this.bianseTime = 0;
            /**迷雾次数 */
            _this.miwuTime = 0;
            /**心碎次数 */
            _this.xinsuiTime = 0;
            /**震颤次数 */
            _this.zhenchanTimeRight = 0;
            _this.zhenchanTimeLeft = 0;
            _this.gamePanleHandle = Game.displayContainer;
            _this.m_frogMgr = Game;
            return _this;
        }
        frogNet.prototype.init = function (index) {
            this.type = 0;
            this.mainLevel = this.GetAttributesByGrade(0).mainType;
            this.minLevel = this.GetAttributesByGrade(0).minorType;
            this.anchorOffsetX = this.width / 2;
            this.anchorOffsetY = this.height / 2;
            this.size1 = serverConfig.config.size;
            this.targetDir = egret.Point.create(0, 0);
            this.targetPoint = egret.Point.create(0, 0);
            this.curPoint = egret.Point.create(0, 0);
            this.lastTargetPoint = egret.Point.create(0, 0);
            this.loadRes();
            this.gamePanleHandle.addChild(this.tralingLayer);
            this.frogAniamtionDis = meterAanimation.getInstance().GetDragonAnimation(1);
            this.addChild(this.frogAniamtionDis);
            FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);
            this.shipinInit();
            this.jisha();
            this.displayShield();
            this.frogLineLength = AIPropsMgr.getInstance().GetAttributesByGrade(0).frogLineLength;
            this.tongueWide = AIPropsMgr.getInstance().GetAttributesByGrade(0).tongueWide;
            this.isUsed = false;
            this.userid = -1;
            this.frogId = index;
            this.visible = false;
            this.gamePanleHandle.addChild(this);
            this.gamePanleHandle.addChild(this.ClipLayer); //添加帧动画层
            this.displayFrogName();
            this.displayEffectOfProps(this.nowPropsType);
            this.targetPost = new egret.Point(0, 0);
            this.myPos = new egret.Point(0, 0);
            this.lastlevel = this.mainLevel;
            this.pointOver = new egret.Point(0, 0);
            this.ismoving = false;
            this.addClip();
            this.all_Image();
            this.EyesInit();
        };
        /**眼睛初始化 */
        frogNet.prototype.EyesInit = function () {
            this.leftEye = new egret.Bitmap();
            this.rightEye = new egret.Bitmap();
            //FrogEyesManage.GetInstance().ChangeEyes(this.frogAniamtionDis, 1, this.leftEye, this.rightEye);
        };
        /**玩家数据更新 */
        frogNet.prototype.dataUpdata = function (e) {
            this.timeStamp = e.timeStamp;
            this.grade = e.grade;
            this.tongueWide = e.tongueWide;
            this.frogLineLength = e.lineLength;
            this.setTargetPoint(e);
            this.displayOrHideShield(e.NewHandProtect.isProtect);
            this.displayEffectOfProps(e.propStates);
            //根据玩家道具状态切换表情显示 
            // if (e.propStates[2].getPropType != 3) {//道具剪刀状态，只剪一次线，剪后小剪刀消失
            // 	if (this.Clip_shuzu[1].visible == true) {
            // 		this.Clip_shuzu[1].visible = false;
            // 	}
            // }
            //if (e.propStates[0].getPropType == 1) {
            if (this.nowPropsType[0] == daojv["隐身"]) {
                this.frogName.alpha = 0.1;
                this.effectOfProps.alpha = 0.1;
                this.alpha = 0.1;
            }
            else {
                this.frogName.alpha = 1;
                this.alpha = 1;
                this.effectOfProps.alpha = 0;
            }
            if (this.nowPropsType[3] == daojv["喝酒"]) {
                if (this.qineyer != 4) {
                    //FrogEyesManage.GetInstance().ChangeEyes(this.frogAniamtionDis, 4, this.leftEye, this.rightEye);
                    this.qineyer = 4;
                }
            }
            else if (this.nowPropsType[7] == daojveff["xuanyun"]) {
                if (this.qineyer != 4) {
                    //FrogEyesManage.GetInstance().ChangeEyes(this.frogAniamtionDis, 4, this.leftEye, this.rightEye);
                    this.qineyer = 4;
                }
            }
            else {
                if (this.qineyer == 4) {
                    var a = 1;
                    if (this.ispunish) {
                        a = 3;
                    }
                    //FrogEyesManage.GetInstance().ChangeEyes(this.frogAniamtionDis, a, this.leftEye, this.rightEye);
                    this.qineyer = a;
                }
            }
            /**判断玩家表情结束 */
            if (this.eyetime != -1 && this.qineyer != 4 && this.qineyer != 3) {
                if (Date.now() - this.eyetime > 500) {
                    //FrogEyesManage.GetInstance().ChangeEyes(this.frogAniamtionDis, 1, this.leftEye, this.rightEye);
                    this.eyetime = -1;
                    this.qineyer = 1;
                }
            }
            /**判断玩家击杀（墨镜）表情结束 */
            if (this.eyetimeMojing != -1) {
                if (Date.now() - this.eyetimeMojing > 1000) {
                    this.shipin1.visible = false;
                    this.eyetimeMojing = -1;
                }
            }
            /**断线处罚 */
            if (!this.ispunish && e.disconnection_line) {
                this.ispunish = true;
                this.changeFaceEye(3, null); //00修改
                //this.changeClothes.changeClothes(this.frogAniamtionDis, 5, this.level);
                //   console.log("frog name"+e.name+"开始处罚")
            }
            if (this.ispunish && !e.disconnection_line) {
                this.ispunish = false;
                //FrogEyesManage.GetInstance().ChangeEyes(this.frogAniamtionDis, 1, this.leftEye, this.rightEye);
                this.qineyer = 1;
                //	console.log("***********/////////****"+this.type)
                FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);
                //	 console.log("frog name"+e.name+"处罚结束")
            }
            this.frogIsHadLine = e.ishadLine;
            this.DetermineKill(e.killNumber);
            if (this.frogIsHadLine && this.userid == DataProl.account && !DataProl.isEvenLine) {
                DataProl.isEvenLine = true;
            }
            // if (this.frogLineLength < e.lineLength) {
            // 	if (this.userid == DataProl.account && this.frogLineLength != 0) {
            // 		this.killNum++;
            // 		DataProl.struckSeveral++;
            // 		webNetworkMananger.getInstance().gameSceneRec.disPlayKillMan(this.killNum);
            // 	}
            // 	//判断击杀
            // 	if (this.userid != null && this.frogLineLength != 0) {
            // 		this.shipin1.visible = true;
            // 		this.eyetimeMojing = Date.now();
            // 	}
            // 	//AIServer.getInstance().roomInfo.roomUser
            // 	this.bianda(e.lineLength);
            // }
            if (webNetworkMananger.isServerMove) {
                if (e.Death.isDeath) {
                    this.frogDied();
                    //this.killNum = 0;
                }
            }
            else {
                if (e.death.isDeath) {
                    if (e.propStates[3].getPropType == 3)
                        this.frogDied();
                    this.killNum = 0;
                }
            }
            this.deathDate = e.Death;
            this.dealFrogUpgrade(e);
            //道具五。。变色
            if (webNetworkMananger.getInstance().gameSceneRec.myUser.userSprit.nowPropsType == daojv["色盲"]) {
                //this.changeClothes.isAcritochromacy = true
            }
            // if (this.changeClothes.isAcritochromacy && this.iscolour) {
            // 	this.changeType();
            // 	this.iscolour = false
            // }
            // if (!this.changeClothes.isAcritochromacy && !this.iscolour) {
            // 	this.iscolour = true;
            // 	this.changeType();
            // }
            // if (this.type != e.frogType) {
            // 	this.type = e.frogType;
            // 	this.changeType();
            // }
            // if (this.type != e.frogType) {
            // 	this.type = e.frogType;
            // 	this.changeType();
            // }
            if (this.type != e.frogType) {
                this.type = e.frogType;
                if (!this.ispunish) {
                    this.changeType();
                    this.nowPropsType[4] = -1;
                    //AIUserMgr.getInstance().resetPlayerOnePropStates(e, 4);
                }
            }
            /**防止两个黄色 */
            if (this.userid != DataProl.account && this.frogName.textColor != 0xffffff)
                this.frogName.textColor = 0xffffff;
            this.setFrogPos();
        };
        /**判断击杀 */
        frogNet.prototype.DetermineKill = function (killNumber) {
            //击杀
            if (this.killNum < killNumber) {
                //预留判断击杀眼镜
                if (!this.shipin1.visible) {
                    this.shipin1.visible = true;
                    this.eyetimeMojing = Date.now();
                }
                //显示击杀特效
                if (this.userid == DataProl.account) {
                    webNetworkMananger.getInstance().gameSceneRec.disPlayKillMan(killNumber);
                }
            }
            this.killNum = killNumber;
        };
        /**添加帧动画到数组 */
        frogNet.prototype.addClip = function () {
            for (var i = 0; i < 9; i++) {
                var data = RES.getRes(ClipName[i] + "_json");
                var txtr = RES.getRes(ClipName[i] + "_png");
                var MovieClipFactory = new egret.MovieClipDataFactory(data, txtr);
                var Clip = new egret.MovieClip(MovieClipFactory.generateMovieClipData(ClipName[i]));
                Clip.name = ClipName[i];
                Clip.anchorOffsetX = Clip.width / 2;
                Clip.anchorOffsetY = Clip.height / 2;
                Clip.scaleX = 0.5;
                Clip.scaleY = 0.5;
                this.Clip_shuzu.push(Clip);
            }
        };
        /**播放帧动画 */
        frogNet.prototype.MovieClipPlay = function (type) {
            var _this = this;
            //return;
            this.Clip_shuzu[type].visible = true;
            if (this.Clip_shuzu[type].name == "xuanyun") {
                //this.netrolelock();//眩晕时锁定摇杆
                //设置眩晕时旋转的星星在青蛙头顶
                this.Clip_shuzu[type].anchorOffsetX = this.shipin1.width / 2;
                this.Clip_shuzu[type].anchorOffsetY = this.shipin1.height / 2;
                this.Clip_shuzu[type].x = -3;
                this.Clip_shuzu[type].y = -50;
                this.addChild(this.Clip_shuzu[type]);
                if (this.xuanyunTime == 0) {
                    this.xuanyunTime = 1;
                    this.Clip_shuzu[type].play(1);
                }
                else {
                    this.Clip_shuzu[type].play(2);
                }
                this.Clip_CallBack(type, 1000);
                return;
            }
            if (this.Clip_shuzu[type].name == "drink") {
                //this.netrolelock();//喝酒时锁定摇杆
                this.Clip_shuzu[type].scaleX = this.Clip_shuzu[type].scaleY = 0.8;
                this.Clip_shuzu[type].anchorOffsetX = this.shipin1.width / 2;
                this.Clip_shuzu[type].anchorOffsetY = this.shipin1.height / 2;
                this.Clip_shuzu[type].x = 10;
                this.Clip_shuzu[type].y = -100;
                this.addChild(this.Clip_shuzu[type]);
                //FrogEyesManage.GetInstance().ChangeEyes(this.frogAniamtionDis, 4, this.leftEye, this.rightEye);
                this.Clip_shuzu[type].play(serverConfig.config.propBuffReationTime.drink / 1000 + 5);
                this.Clip_CallBack(type, serverConfig.config.propBuffReationTime.drink);
                return;
            }
            if (this.Clip_shuzu[type].name == "paopao") {
                this.addChild(this.Clip_shuzu[type]);
                //设定眩晕时副帧动画（第二个帧动画）的冒泡的位置从青蛙头顶开始
                this.Clip_shuzu[type].x = -100;
                this.Clip_shuzu[type].y = -150;
                this.Clip_shuzu[type].play(serverConfig.config.propBuffReationTime.drink / 1000);
                return;
            }
            if (this.Clip_shuzu[type].name == "bianse") {
                this.Clip_shuzu[type].scaleX = this.Clip_shuzu[type].scaleY = 1;
                this.ClipLayer.addChild(this.Clip_shuzu[type]);
                if (this.bianseTime == 0) {
                    this.setClip(type, -45, -160, 1);
                    this.bianseTime = 1;
                }
                else {
                    this.setClip(type, -45, -160, 2);
                }
                this.Clip_CallBack(type, 1000);
                return;
            }
            if (this.Clip_shuzu[type].name == "ice") {
                //this.netrolelock();//眩晕时锁定摇杆
                this.ClipLayer.addChild(this.Clip_shuzu[type]);
                this.Clip_shuzu[type].scaleX = this.Clip_shuzu[type].scaleY = 0.8;
                this.setClip(type, 10, -140, serverConfig.config.propBuffReationTime.ice / 1000);
                this.Clip_CallBack(type, serverConfig.config.propBuffReationTime.ice);
                this.ice_Play();
                return;
            }
            if (this.Clip_shuzu[type].name == "jiandao") {
                this.ClipLayer.addChild(this.Clip_shuzu[type]);
                this.setClip(type, 10, -125, serverConfig.config.propBuffReationTime.cut / 1000);
                this.Clip_CallBack(type, serverConfig.config.propBuffReationTime.cut);
                return;
            }
            if (this.Clip_shuzu[type].name == "heart") {
                this.ClipLayer.addChild(this.Clip_shuzu[type]);
                this.setClip(type, 0, -85, 2);
                return;
            }
            if (this.Clip_shuzu[type].name == "miwu") {
                this.Clip_shuzu[type].scaleX = this.Clip_shuzu[type].scaleY = 0.8;
                //this.ClipLayer.addChild(this.Clip_shuzu[type]);
                this.addChild(this.Clip_shuzu[type]);
                this.Clip_shuzu[type].x = -40;
                this.Clip_shuzu[type].y = -60;
                if (this.miwuTime == 0) {
                    this.Clip_shuzu[type].play(1);
                    this.miwuTime = 1;
                }
                else {
                    this.Clip_shuzu[type].play(2);
                }
                this.Clip_CallBack(type, 1000);
                return;
            }
            if (this.Clip_shuzu[type].name == "xinsui") {
                //this.netrolelock();//心碎时锁定摇杆
                this.addChild(this.Clip_shuzu[type]);
                //设定眩晕时副帧动画（第二个帧动画）的冒泡的位置从青蛙头顶开始
                this.Clip_shuzu[type].x = -30;
                this.Clip_shuzu[type].y = -100;
                this.Clip_shuzu[type].scaleX = this.Clip_shuzu[type].scaleY = 0.8;
                if (this.xinsuiTime == 0) {
                    this.xinsuiTime = 1;
                    this.Clip_shuzu[type].play(1);
                }
                else {
                    this.Clip_shuzu[type].play(2);
                }
                this.Clip_CallBack(type, 1000);
                this.eye_change1();
                this.eye_change2();
                egret.Tween.get(this.Clip_shuzu[type])
                    .to({ alpha: 1 }, 1000 + 10)
                    .call(function () {
                    _this.Clip_shuzu[type].visible = false;
                    _this.nowPropsType[8] = -1;
                }, this);
                return;
            }
        };
        /** 冰冻效果2：青蛙身上出现冰块*/
        frogNet.prototype.ice_Play = function () {
            //this.ice2.texture = RES.getRes("ice_2_png");
            this.ice2.anchorOffsetX = this.ice2.width / 2;
            this.ice2.anchorOffsetY = this.ice2.height / 2;
            if (this.mainLevel == 1) {
                this.ice2.scaleX = this.ice2.scaleY = 0.8;
            }
            else if (this.mainLevel == 2) {
                this.ice2.scaleX = this.ice2.scaleY = 0.9;
            }
            else if (this.mainLevel == 3) {
                this.ice2.scaleX = this.ice2.scaleY = 1.1;
            }
            else {
                this.ice2.scaleX = this.ice2.scaleY = 1.2;
            }
            this.ice2.x = 0;
            this.ice2.y = -10;
            this.ice2.visible = true;
            this.addChild(this.ice2);
            this.ice2.alpha = 0;
            egret.Tween.get(this.ice2)
                .to({ alpha: 1 }, 1000)
                .to({ alpha: 1 }, serverConfig.config.propBuffReationTime.ice - 2000)
                .to({ alpha: 0 }, 1000);
            return;
        };
        /** 舔到异色青蛙眼睛两边变化*/
        frogNet.prototype.eye_change1 = function () {
            var _this = this;
            //FrogEyesManage.GetInstance().ChangeEyes(this.frogAniamtionDis, 5, this.leftEye, this.rightEye);
            // var heixian: eui.Image = new eui.Image();
            // heixian.texture = RES.getRes("heixian_png");
            // heixian.anchorOffsetX = heixian.width / 2;
            // heixian.anchorOffsetY = heixian.height / 2;
            // var han: eui.Image = new eui.Image();
            // han.texture = RES.getRes("han_png");
            // han.anchorOffsetX = han.width / 2;
            // han.anchorOffsetY = han.height / 2;
            this.han.visible = true;
            this.heixian.visible = true;
            if (this.mainLevel == 1) {
                this.heixian.x = 20;
                this.heixian.y = -45;
                this.han.x = -30;
                this.han.y = -40;
                this.heixian.scaleX = this.heixian.scaleY = 0.7;
                this.han.scaleX = this.han.scaleY = 0.2;
            }
            else if (this.mainLevel == 2) {
                this.heixian.x = 22;
                this.heixian.y = -45;
                this.han.x = -22;
                this.han.y = -40;
                this.heixian.scaleX = this.heixian.scaleY = 0.75;
                this.han.scaleX = this.han.scaleY = 0.25;
            }
            else if (this.mainLevel == 3) {
                this.heixian.x = 30;
                this.heixian.y = -45;
                this.han.x = -30;
                this.han.y = -40;
                this.heixian.scaleX = this.heixian.scaleY = 0.8;
                this.han.scaleX = this.han.scaleY = 0.3;
            }
            else {
                this.heixian.x = 40;
                this.heixian.y = -45;
                this.han.x = -30;
                this.han.y = -40;
                this.heixian.scaleX = this.heixian.scaleY = 0.85;
                this.han.scaleX = this.han.scaleY = 0.35;
            }
            this.han.x = -30;
            this.han.y = -40;
            this.addChild(this.heixian);
            this.addChild(this.han);
            this.han.alpha = 0;
            egret.Tween.get(this.heixian)
                .to({ alpha: 1 }, 50)
                .to({ y: this.heixian.y + 10 }, 950);
            egret.Tween.get(this.han)
                .to({ alpha: 1 }, 50)
                .to({ scaleX: this.han.scaleX + 0.8, scaleY: this.han.scaleY + 0.8 }, 100)
                .to({ scaleX: this.han.scaleX - 0.8, scaleY: this.han.scaleY - 0.8 }, 100)
                .to({ scaleX: this.han.scaleX + 0.8, scaleY: this.han.scaleY + 0.8 }, 100)
                .to({ scaleX: this.han.scaleX - 0.8, scaleY: this.han.scaleY - 0.8 }, 100)
                .to({ scaleX: this.han.scaleX + 0.8, scaleY: this.han.scaleY + 0.8 }, 100)
                .to({ scaleX: this.han.scaleX - 0.8, scaleY: this.han.scaleY - 0.8 }, 100)
                .to({ scaleX: this.han.scaleX + 0.8, scaleY: this.han.scaleY + 0.8 }, 100)
                .to({ scaleX: this.han.scaleX - 0.8, scaleY: this.han.scaleY - 0.8 }, 100)
                .to({ scaleX: this.han.scaleX + 0.8, scaleY: this.han.scaleY + 0.8 }, 100)
                .to({ alpha: 0 }, 60)
                .call(function () {
                _this.han.visible = false;
                _this.heixian.visible = false;
                //FrogEyesManage.GetInstance().ChangeEyes(this.frogAniamtionDis, 1, this.leftEye, this.rightEye);
            }, this);
            return;
        };
        /** 舔到异色青蛙眼睛内变化*/
        frogNet.prototype.eye_change2 = function () {
            // var eyeLeft: eui.Image = new eui.Image();
            // eyeLeft.texture = RES.getRes("eye_black_png");
            // eyeLeft.anchorOffsetX = eyeLeft.width / 2;
            // eyeLeft.anchorOffsetY = eyeLeft.height / 2;
            // var eyeRight: eui.Image = new eui.Image();
            // eyeRight.texture = RES.getRes("eye_black_png");
            // eyeRight.anchorOffsetX = eyeRight.width / 2;
            // eyeRight.anchorOffsetY = eyeRight.height / 2;
            if (this.mainLevel == 1) {
                this.eyeLeft.scaleX = this.eyeLeft.scaleY = 0.33;
                this.eyeRight.scaleX = this.eyeRight.scaleY = 0.33;
                this.eyeLeft.x = -14;
                this.eyeRight.x = 13;
            }
            else if (this.mainLevel == 2) {
                this.eyeLeft.scaleX = this.eyeLeft.scaleY = 0.35;
                this.eyeRight.scaleX = this.eyeRight.scaleY = 0.35;
                this.eyeLeft.x = -10;
                this.eyeRight.x = 17;
            }
            else if (this.mainLevel == 3) {
                this.eyeLeft.scaleX = this.eyeLeft.scaleY = 0.38;
                this.eyeRight.scaleX = this.eyeRight.scaleY = 0.38;
                this.eyeLeft.x = -14;
                this.eyeRight.x = 19;
            }
            else {
                this.eyeLeft.scaleX = this.eyeLeft.scaleY = 0.4;
                this.eyeRight.scaleX = this.eyeRight.scaleY = 0.4;
                this.eyeLeft.x = -14;
                this.eyeRight.x = 19;
            }
            this.eyeLeft.y = -33;
            this.eyeRight.y = -33;
            this.eyeLeft.visible = true;
            this.eyeRight.visible = true;
            this.addChild(this.eyeLeft);
            this.addChild(this.eyeRight);
            this.eye_Tween(this.eyeLeft);
            this.eye_Tween(this.eyeRight);
        };
        /**眼珠tween动画 */
        frogNet.prototype.eye_Tween = function (eye) {
            var _this = this;
            egret.Tween.get(eye)
                .to({ scaleX: 0, scaleY: 0 }, 300)
                .call(function () {
                //eye.texture = RES.getRes("eye_22_png");
                eye.texture = _this.eyeLR.texture;
                eye.anchorOffsetX = eye.width / 2;
                eye.anchorOffsetY = eye.height / 2;
                eye.scaleX = 0.2;
                eye.scaleY = 1;
                egret.Tween.get(eye)
                    .to({ scaleX: 1 }, 200)
                    .to({ scaleX: 0.2 }, 200)
                    .to({ alpha: 1 }, 310)
                    .call(function () {
                    eye.visible = false;
                }, _this);
            }, this);
        };
        /**帧动画回调的隐藏动画方法 */
        frogNet.prototype.Clip_CallBack = function (type, time) {
            var _this = this;
            egret.Tween.get(this.Clip_shuzu[type])
                .to({ alpha: 1 }, time + 10)
                .call(function () {
                _this.Clip_shuzu[type].visible = false;
                //this.nowPropsType[type + 1] = -1;
                if (_this.userid == DataProl.account) {
                    _this.OnresetShadowFogPoint(_this);
                }
            }, this);
        };
        frogNet.prototype.setClip = function (type, x, y, num) {
            var _this = this;
            this.Clip_shuzu[type].play(num); //帧动画播放次数
            ///**固定动画播放位置在名字正上方，且方向固定 */
            var nameTimer = new egret.Timer(10, -1);
            nameTimer.addEventListener(egret.TimerEvent.TIMER, function (e) {
                _this.Clip_shuzu[type].x = _this.x + x;
                _this.Clip_shuzu[type].y = _this.y + y;
            }, this);
            nameTimer.start();
        };
        /**显示道具效果 */
        frogNet.prototype.displayEffectOfProps = function (propstates) {
            //for (var i = 0; i < propstates.length; i++) {
            var type = propstates.getPropType;
            if (type == 0) {
                this.nowPropsType = [0, 0, 0, 0, 0, 0, 0, 0, 0];
                this.ClipLayer.removeChildren();
                //解锁摇杆
                if (this.userid == DataProl.account) {
                    this.netunrolelock();
                }
                return;
                //continue;
            }
            if (this.nowPropsType[type - 1] == type) {
                //continue;
                return;
            }
            if (type == 1) {
                this.effectOfProps = this.zhuangtai_1;
                this.effectOfProps.anchorOffsetX = this.effectOfProps.width / 2;
                this.effectOfProps.anchorOffsetY = this.effectOfProps.height / 2;
                this.effectOfProps.scaleX = this.effectOfProps.scaleY = 0.5;
                this.effectOfProps.visible = true;
                this.alpha = 0.1;
                this.nowPropsType[type - 1] = type;
                return;
                //console.log("111111111              " + this.nowPropsType);
                //continue;
            }
            if (type == 6 || type == 7) {
                //continue;
                return;
            }
            if (type == 8) {
                this.nowPropsType[type - 1] = type;
                this.ClipLayer.removeChildren();
                //锁定摇杆
                if (this.userid == DataProl.account) {
                    this.netrolelock();
                }
                this.MovieClipPlay(type - 2); //帧动画播放方法
                this.bowen();
                return;
            }
            if (type == 9) {
                this.nowPropsType[type - 1] = type;
                this.ClipLayer.removeChildren();
                this.MovieClipPlay(type - 1); //帧动画播放方法
                return;
            }
            if (type == 3 || type == 2 || type == 5) {
                this.ClipLayer.removeChildren();
                if (type == 2) {
                    //锁定摇杆
                    if (this.userid == DataProl.account) {
                        this.netrolelock();
                    }
                }
                this.MovieClipPlay(type - 2); //帧动画播放方法
                if (type == 5) {
                    this.MovieClipPlay(7); //播放变色迷雾
                }
                this.nowPropsType[type - 1] = type;
                return;
                //console.log("222222222222          " + this.nowPropsType);
                //continue;
            }
            if (type == 4) {
                this.ClipLayer.removeChildren();
                //锁定摇杆
                if (this.userid == DataProl.account) {
                    this.netrolelock();
                }
                this.MovieClipPlay(type - 2); //帧动画播放方法
                this.MovieClipPlay(5);
                this.nowPropsType[type - 1] = type;
                return;
                //continue;
            }
            //}
        };
        /**添加碰撞是左右两侧的波纹(bowen) */
        frogNet.prototype.bowen = function () {
            this.bwRight.x = 50;
            this.bwRight.y = 0;
            this.bwRight.visible = true;
            this.addChild(this.bwRight);
            this.bwLeft.skewY = 180;
            this.bwLeft.x = -50;
            this.bwLeft.y = 0;
            this.bwLeft.visible = true;
            this.addChild(this.bwLeft);
            this.zhenchan(this.bwRight, this.zhenchanTimeRight, 60, 50);
            this.zhenchan(this.bwLeft, this.zhenchanTimeLeft, -60, -50);
        };
        frogNet.prototype.zhenchan = function (picture, time, x1, x2) {
            var _this = this;
            egret.Tween.get(picture)
                .to({ x: x1 }, 50)
                .to({ x: x2 }, 50)
                .to({ alpha: 1 }, 5)
                .call(function (e) {
                if (time < serverConfig.config.propBuffReationTime.dizzy / 100 - 1) {
                    time += 1;
                    _this.zhenchan(picture, time, x1, x2);
                }
                else {
                    time = 0;
                    picture.visible = false;
                }
            });
        };
        /**饰品设置 */
        frogNet.prototype.shipinInit = function () {
            this.shipin.texture = RES.getRes("shipin_1");
            this.shipin.anchorOffsetX = this.shipin.width / 2;
            this.shipin.anchorOffsetY = this.shipin.height / 2;
            this.shipin.x = 0;
            this.shipin.y = -35;
            this.shipin.scaleX = 0.7;
            this.shipin.scaleY = 0.85;
            this.addChild(this.shipin);
            this.shipin.visible = false;
            //this.changeShipin("shipin_" + (Math.floor(Math.random()*5+1)));
        };
        /**击杀表情 */
        frogNet.prototype.jisha = function () {
            this.shipin1.texture = RES.getRes("mojing");
            this.shipin1.anchorOffsetX = this.shipin1.width / 2;
            this.shipin1.anchorOffsetY = this.shipin1.height / 2;
            this.shipin1.x = 0;
            this.shipin1.y = -35;
            this.shipin1.scaleX = 0.7;
            this.shipin1.scaleY = 0.85;
            this.addChild(this.shipin1);
            this.shipin1.visible = false;
            //this.changeShipin("shipin_" + (Math.floor(Math.random()*5+1)));
        };
        /**改变饰品 */
        frogNet.prototype.changeShipin = function (shipintype) {
            switch (shipintype) {
                case "shipin_1":
                    this.shipin.texture = this.shipin_1.texture;
                    break;
                case "shipin_2":
                    this.shipin.texture = this.shipin_2.texture;
                    break;
                case "shipin_3":
                    this.shipin.texture = this.shipin_3.texture;
                    break;
                case "shipin_4":
                    this.shipin.texture = this.shipin_4.texture;
                    break;
                case "shipin_5":
                    this.shipin.texture = this.shipin_5.texture;
                    break;
            }
            //this.shipin.texture = RES.getRes(shipintype);
            this.shipin.visible = true;
        };
        /**显示护盾 */
        frogNet.prototype.displayShield = function () {
            this.shieldOuter.texture = RES.getRes("hudun_wai");
            this.shieldInside.texture = RES.getRes("hudun_nei");
            this.shieldOuter.anchorOffsetX = this.shieldOuter.width / 2;
            this.shieldOuter.anchorOffsetY = this.shieldOuter.height / 2;
            this.shieldInside.anchorOffsetX = this.shieldInside.width / 2;
            this.shieldInside.anchorOffsetY = this.shieldInside.height / 2;
            this.shieldOuter.x = this.shieldInside.x = 0;
            this.shieldOuter.y = this.shieldInside.y = -25;
            this.addChild(this.shieldOuter);
            this.addChild(this.shieldInside);
            this.displayOrHideShield(false);
            this.tu.anchorOffsetX = this.tu.width / 2;
            this.tu.anchorOffsetY = this.tu.height / 2;
            this.tu.x = 0;
            this.tu.y = -35;
            this.addChild(this.tu);
            this.tu.visible = false;
        };
        /**显示或隐藏保护罩 */
        frogNet.prototype.displayOrHideShield = function (disOrHide) {
            this.shieldOuter.visible = this.shieldInside.visible = disOrHide;
            if (disOrHide) {
                egret.Tween.get(this.shieldInside).to({ rotation: (this.shieldInside.rotation + 4) }, 1000 / 60);
                this.killNum = 0;
            }
            else {
                egret.Tween.removeTweens(this.shieldInside);
            }
        };
        /**伸舌 */
        // public loll() {
        // 	if (!this.tweenOver) {
        // 		return;
        // 	}
        // 	egret.Tween.removeTweens(this);
        // 	let tonguePoint = this.localToGlobal(this.tongue.x, this.tongue.y);
        // 	let myPoint = this.parent.localToGlobal(this.x, this.y);
        // 	let direction = tonguePoint.subtract(myPoint);
        // 	//给服务器发送射击信息
        // 	AIServer.getInstance().shoot(this.userid, direction);
        // }
        /**伸舌动画 */
        frogNet.prototype.lollAnime = function (longTongue) {
            var length = longTongue == 0 ? this.frogLineLength : longTongue;
            var tongue = this.tongue;
            tongue.height = this.scaleX * this.tongueWide;
            tongue.y = this.scaleX * (0 - 40);
            tongue.visible = true;
            tongue.width = 0;
            egret.Tween.get(tongue).to({ width: length * frogConfig.independent_Long_tongue_coefficient }, 100).to({ width: 0 }, 100).call(function (e) { tongue.visible = false; });
        };
        /**伸舌 */
        frogNet.prototype.loll = function () {
            var _this = this;
            egret.Tween.removeTweens(this);
            var tongue = new eui.Image;
            tongue.texture = RES.getRes("shetou");
            tongue.anchorOffsetY = tongue.height / 2;
            tongue.height = this.scaleX * tongue.height;
            tongue.width = this.scaleX * this.tongueWide;
            tongue.y = this.scaleX * (0 - 50);
            tongue.rotation = (0 - 90);
            this.addChild(tongue);
            egret.Tween.get(tongue).to({ width: this.frogLineLength }, 100).to({ width: 0 }, 100).call(function (e) { _this.removeChild(tongue); });
            if (this.userid == DataProl.account) {
                var tonguePoint = this.localToGlobal(tongue.x, tongue.y);
                var myPoint = this.parent.localToGlobal(this.x, this.y);
                var direction = tonguePoint.subtract(myPoint);
                var m_AwesomeMessage = new awesomepackage.AwesomeMessage();
                var m_c2sShoot = new awesomepackage.c2sShoot();
                m_c2sShoot.account = DataProl.account;
                m_c2sShoot.roomId = DataProl.roomid;
                m_c2sShoot.dirX = Math.floor(direction.x * 10);
                m_c2sShoot.dirY = Math.floor(direction.y * 10);
                m_AwesomeMessage.meesageId = 1030;
                m_AwesomeMessage.data = awesomepackage.c2sShoot.encode(m_c2sShoot).finish();
                var buffer = awesomepackage.AwesomeMessage.encode(m_AwesomeMessage).finish();
                var byte2 = new egret.ByteArray(buffer);
                webNetworkMananger.getInstance().SendBitMeesage(byte2);
            }
        };
        /**获取朝向坐标 */
        frogNet.prototype.getTowardCoordinates = function () {
            var front = this.localToGlobal(0, this.size);
            var myPoint = this.parent.localToGlobal(this.x, this.y);
            var direction = front.subtract(myPoint);
            return direction;
        };
        /**反向弹出 */
        frogNet.prototype.ReversePop_up = function (point, isaccount) {
            if (isaccount === void 0) { isaccount = false; }
            var myOrientation = this.getTowardCoordinates();
            //this.netrolelock();
            if (myOrientation != null && myOrientation != undefined) {
                myOrientation.setTo(myOrientation.x, myOrientation.y);
                myOrientation.normalize(100);
                var targePoint = myOrientation.add(new egret.Point(this.x, this.y));
                // egret.Tween.get(this).to({ x: targePoint.x, y: targePoint.y }, 200).call(e => {
                // 	//this.canMove = true 
                // });
                if (isaccount) {
                    var myAnimation = TweenLite.to(this, 0.5, { x: targePoint.x, y: targePoint.y, ease: Back.easeInOut });
                    myAnimation.eventCallback("onComplete", this.OnresetShadowFogPoint, [this]);
                }
                else
                    TweenLite.to(this, 0.5, { x: targePoint.x, y: targePoint.y, ease: Back.easeInOut });
                //	this.netunrolelock()
            }
        };
        //console.log("X,Y" + obj.x + "," + obj.y);
        /**重置影子青蛙的位置 */
        frogNet.prototype.OnresetShadowFogPoint = function (obj) {
            var shadowFrog = obj.m_frogMgr.findFrogById(DataProl.shadowFrogId);
            if (shadowFrog != null) {
                shadowFrog.x = obj.x;
                shadowFrog.y = obj.y;
                console.log("同步更改影子青蛙" + DataProl.shadowFrogId);
            }
        };
        /**青蛙动画初始化 */
        frogNet.prototype.frogAnimationInit = function () {
            this.removeChild(this.frogAniamtionDis);
            this.frogAniamtionDis.armature.dispose();
            this.frogAniamtionDis = null;
        };
        /**通过分数获取属性 */
        frogNet.prototype.GetAttributesByGrade = function (grade) {
            /**舌宽 */
            var tongueWideData = 0;
            /**线长 */
            var lineLength = 0;
            /**大级 */
            var largeMagnitude = 0;
            /**小级 */
            var smallMagnitude = 0;
            if (parseInt(grade) >= 15000) {
                tongueWideData = 15;
                lineLength = 600;
                largeMagnitude = 4;
            }
            else if (parseInt(grade) >= 9000) {
                tongueWideData = 13;
                lineLength = 500;
                largeMagnitude = 3;
                smallMagnitude = 6;
            }
            else if (parseInt(grade) >= 7800) {
                tongueWideData = 13;
                lineLength = 460;
                largeMagnitude = 3;
                smallMagnitude = 5;
            }
            else if (parseInt(grade) >= 6600) {
                tongueWideData = 12;
                lineLength = 420;
                largeMagnitude = 3;
                smallMagnitude = 4;
            }
            else if (parseInt(grade) >= 5600) {
                tongueWideData = 12;
                lineLength = 380;
                largeMagnitude = 3;
                smallMagnitude = 3;
            }
            else if (parseInt(grade) >= 4800) {
                tongueWideData = 11;
                lineLength = 350;
                largeMagnitude = 3;
                smallMagnitude = 2;
            }
            else if (parseInt(grade) >= 4000) {
                tongueWideData = 11;
                lineLength = 320;
                largeMagnitude = 3;
                smallMagnitude = 1;
            }
            else if (parseInt(grade) >= 3200) {
                tongueWideData = 10;
                lineLength = 280;
                largeMagnitude = 2;
                smallMagnitude = 6;
            }
            else if (parseInt(grade) >= 2600) {
                tongueWideData = 10;
                lineLength = 260;
                largeMagnitude = 2;
                smallMagnitude = 5;
            }
            else if (parseInt(grade) >= 2100) {
                tongueWideData = 9;
                lineLength = 240;
                largeMagnitude = 2;
                smallMagnitude = 4;
            }
            else if (parseInt(grade) >= 1700) {
                tongueWideData = 9;
                lineLength = 220;
                largeMagnitude = 2;
                smallMagnitude = 3;
            }
            else if (parseInt(grade) >= 1300) {
                tongueWideData = 8;
                lineLength = 200;
                largeMagnitude = 2;
                smallMagnitude = 2;
            }
            else if (parseInt(grade) >= 1000) {
                tongueWideData = 8;
                lineLength = 180;
                largeMagnitude = 2;
                smallMagnitude = 1;
            }
            else if (parseInt(grade) >= 700) {
                tongueWideData = 7;
                lineLength = 150;
                largeMagnitude = 1;
                smallMagnitude = 6;
            }
            else if (parseInt(grade) >= 550) {
                tongueWideData = 7;
                lineLength = 140;
                largeMagnitude = 1;
                smallMagnitude = 5;
            }
            else if (parseInt(grade) >= 400) {
                tongueWideData = 6;
                lineLength = 130;
                largeMagnitude = 1;
                smallMagnitude = 4;
            }
            else if (parseInt(grade) >= 250) {
                tongueWideData = 6;
                lineLength = 120;
                largeMagnitude = 1;
                smallMagnitude = 3;
            }
            else if (parseInt(grade) >= 100) {
                tongueWideData = 5;
                lineLength = 110;
                largeMagnitude = 1;
                smallMagnitude = 2;
            }
            else {
                tongueWideData = 5;
                lineLength = 100;
                largeMagnitude = 1;
                smallMagnitude = 1;
            }
            this.bianda(lineLength);
            return {
                tongueWide: tongueWideData,
                frogLineLength: lineLength,
                mainType: largeMagnitude,
                minorType: smallMagnitude
            };
        };
        /**处理青蛙升级
         * @param playerData 玩家数据
         */
        frogNet.prototype.dealFrogUpgrade = function (playerData) {
            //升级数据不对，暂时关闭升级
            return;
            if (this.level == playerData.level) {
                return;
            }
            //升级播放升级特效
            if (this.level < playerData.level) {
                this.playUserUpgrade(this._texture, this._config, 0, 0);
            }
            //如果主要等级不同换龙骨
            if (Math.floor(this.level / 10) != Math.floor(playerData.level / 10)) {
                this.level = playerData.level;
                /**主要等级 */
                var mainLevel = Math.floor(this.level / 10);
                this.frogAnimationInit();
                this.frogAniamtionDis = meterAanimation.getInstance().GetDragonAnimation(mainLevel);
                this.addChild(this.frogAniamtionDis);
                this.setChildIndex(this.frogAniamtionDis, 0);
                //升级体积变化
                switch (mainLevel) {
                    case 1:
                        this.scaleX = this.scaleY = 1;
                        break;
                    case 2:
                        this.scaleX = this.scaleY = 1.3;
                        break;
                    case 3:
                        this.scaleX = this.scaleY = 1.7;
                        break;
                    case 4:
                        this.scaleX = this.scaleY = 2.2;
                        break;
                    default:
                        break;
                }
            }
            this.level = playerData.level;
            FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);
        };
        /**连线青蛙后置 */
        frogNet.prototype.setFrogPos = function () {
            this.frogAniamtionDis.y = this.frogIsHadLine ? 0 : 0;
            this.shieldOuter.y = this.shieldInside.y = this.frogAniamtionDis.y - 25;
        };
        /**设置下个目标点 */
        frogNet.prototype.setTargetPoint = function (point) {
            if (this.userid == DataProl.shadowFrogId) {
                this.targetPoint.x = this.x + point.x;
                this.targetPoint.y = this.y + point.y;
                return;
            }
            //	console.log("服务器发送坐标:x:" + point.x + "y:" + point.y);
            this.targetPoint.x = Math.floor(point.x);
            this.targetPoint.y = Math.floor(point.y);
            if (this.canMove) {
                this.frogMoveto();
            }
        };
        frogNet.prototype.changeType = function () {
            FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);
        };
        frogNet.prototype.update = function () {
        };
        /**青蛙转向 */
        frogNet.prototype.frogVeer = function () {
            if (!this.canMove) {
                return;
            }
            egret.Tween.removeTweens(this);
            var angle = this.getFrogAngle(this.x, this.y, this.targetPoint.x, this.targetPoint.y);
            if (this.userid == DataProl.shadowFrogId && this.gamePanleHandle.yaogan) {
                angle = this.gamePanleHandle.yaogan.getRotation();
            }
            if (!this.frogIsHadLine) {
                if (this.x == this.targetPoint.x && this.y == this.targetPoint.y) {
                    return;
                }
            }
            if (!isNaN(angle)) {
                var addtime = 0;
                if (angle > 160) {
                    addtime += angle / 90;
                }
                egret.Tween.get(this).to({ rotation: angle }, gameGlobal.global.frogRotateTime - addtime);
            }
        };
        /*判断*/
        frogNet.prototype.shadowFrogMoveto = function (target) {
            egret.Tween.removeTweens(this);
            this.curPoint.x = this.x;
            this.curPoint.y = this.y;
            // if (!this.frogIsHadLine) {
            // 	if (this.x == this.targetPoint.x && this.y == this.targetPoint.y) {
            // 		//console.log("玩家没有移动");
            // 		return;
            // 	}
            // }
            /**影子青蛙移动 */
            this.x = this.x + target.x;
            this.y = this.y + target.y;
            if (this.x > gameGlobal.global.gameWidth - 55) {
                console.log("bianjie1");
                this.x = gameGlobal.global.gameWidth - 55;
            }
            if (this.y > gameGlobal.global.gameHeight - 65) {
                this.y = gameGlobal.global.gameHeight - 65;
                console.log("bianjie2");
            }
            if (this.x < 50) {
                this.x = 50;
                console.log("bianjie3");
            }
            if (this.y < 60) {
                this.y = 60;
                console.log("bianjie4");
            }
            return;
        };
        /**青蛙移动 */
        frogNet.prototype.frogMoveto = function () {
            //var angle = this.getFrogAngle(this.x, this.y, this.targetPoint.x, this.targetPoint.y);
            //TweenLite.killTweensOf(this);
            egret.Tween.removeTweens(this);
            this.curPoint.x = this.x;
            this.curPoint.y = this.y;
            if (!this.frogIsHadLine) {
                if (this.x == this.targetPoint.x && this.y == this.targetPoint.y) {
                    //console.log("玩家没有移动");
                    return;
                }
            }
            /**影子青蛙移动 */
            if (this.userid == DataProl.shadowFrogId) {
                this.x = this.targetPoint.x;
                this.y = this.targetPoint.y;
                return;
            }
            // if (!isNaN(angle)) {
            // 	var addtime = 0;
            // 	if (angle > 160) {
            // 		addtime += angle / 90;
            // 	}
            // 	egret.Tween.get(this).to({ rotation: angle }, gameGlobal.global.frogRotateTime - addtime);
            // }
            //console.log("angle" + angle);
            var dis = egret.Point.distance(this.targetPoint, this.curPoint);
            if (dis > this.speed) {
                //console.log("angle" + dis);
            }
            //console.log("targetPoint" + this.targetPoint.x);
            //console.log("mypoint" + this.x);
            // var myArray = [1,2,3,4];
            // TweenLite.to(myArray, 0.1, { endArray: [10,20,30,40] });
            //如果目标点没有变，则直接移动
            if (this.targetPoint.equals(this.lastTargetPoint)) {
                return;
            }
            else {
                // let nextDir = new egret.Point();
                // nextDir = egret.Point.interpolate(this.targetPoint, this.curPoint, this.interpolation_plan / 6);
                // this.interpolation_plan++;
                // if (this.interpolation_plan >= 6) {
                // 	this.interpolation_plan = 1;
                // }
                // this.ismoving = true;
                var diftime = this.timeStamp + 100 - Date.now();
                //console.log("time" + diftime);
                // if (diftime < 0) {
                // 	diftime = 1;
                // }
                this.lastTargetPoint.x = this.targetPoint.x;
                this.lastTargetPoint.y = this.targetPoint.y;
                //egret.Tween.get(this).to({ x: this.targetPoint.x, y: this.targetPoint.y }, 1000).call(this.tweenComplete);;
                var myAnimation = TweenLite.to(this, 1 / 9, { x: this.targetPoint.x, y: this.targetPoint.y, ease: Linear.easeNone, onComplete: this.onFinishTween });
                myAnimation.eventCallback("onUpdate", this.OnTweenliteUpdate, [this]);
                myAnimation.eventCallback("onComplete", this.onFinishTween, [this]);
            }
        };
        frogNet.prototype.onFinishTween = function (obj) {
            //console.log("end X,Y" + obj.x + "," + obj.y);
        };
        frogNet.prototype.OnTweenliteUpdate = function (obj) {
            //console.log("X,Y" + obj.x + "," + obj.y);
        };
        frogNet.prototype.tweenComplete = function () {
            //console.log("玩家移动完毕");
            this.ismoving = false;
        };
        /**获取玩家需要旋转的角度 */
        frogNet.prototype.getFrogAngle = function (mx, my, targetx, targety) {
            var angle;
            var ligUserId = null;
            var point = null;
            /*	if (!webNetworkMananger.isServerMove)
                {
                    console.log("个舌头");
                }
                else
                {
                    console.log("11111111");
                }*/
            if (this.frogIsHadLine) {
                //if (!webNetworkMananger.isServerMove) {
                ligUserId = this.getLineUserId();
                if (ligUserId != null)
                    point = this.getLineUserPoint(ligUserId);
                else
                    angle = Util.getInstance().getRotation({ x: mx, y: my }, { x: targetx, y: targety });
                if (point != null)
                    angle = Util.getInstance().getRotation({ x: mx, y: my }, { x: point.x, y: point.y });
                else
                    angle = Util.getInstance().getRotation({ x: mx, y: my }, { x: targetx, y: targety });
            }
            else {
                if (this.userid == DataProl.account) {
                    if (webNetworkMananger.getInstance().gameSceneRec.yaogan) {
                        angle = webNetworkMananger.getInstance().gameSceneRec.yaogan.getRotation();
                    }
                }
                else {
                    angle = Util.getInstance().getRotation({ x: this.x, y: this.y }, { x: targetx, y: targety });
                }
            }
            return angle;
        };
        /**
         * 获取连线玩家Id
         */
        frogNet.prototype.getLineUserId = function () {
            return this.m_frogMgr.getLigatureUserId(this.userid);
        };
        /**
         * 获取连线玩家坐标
         */
        frogNet.prototype.getLineUserPoint = function (ligaUserId) {
            var frog = this.m_frogMgr.findFrogById(ligaUserId);
            if (frog == null) {
                return null;
            }
            return { x: frog.x, y: frog.y };
        };
        /***
         * reset frog states when it's not use
         */
        /**青蛙重置 */
        frogNet.prototype.reset = function () {
            this.visible = false;
            this.isUsed = false;
            this.userid = -1;
            if (this.frogTrai)
                this.frogTrai.visible = false;
            this.x = 0;
            this.y = 0;
            this.scaleX = this.scaleY = 1;
            this.targetPoint.x = 0;
            this.targetPoint.y = 0;
            this.displayOrHideShield(false);
            this.frogName.text = "";
            this.frogName.visible = false;
            this.qineyer = 1;
            this.ClipLayer.removeChildren(); //清除所有在ClipLayer层上的动画
            this.nowPropsType = [-1, -1, -1, -1, -1, -1, -1, -1, -1];
        };
        frogNet.prototype.sizeFrog = function (lenth) {
            var size = 1;
            if (lenth > 150) {
                lenth -= 149;
                size = 1 + (lenth / this.size1);
                if (size >= 2.8) {
                    size = 2.8;
                }
            }
            else {
            }
            return size;
        };
        frogNet.prototype.bianda = function (lenth) {
            if (lenth > 150) {
                lenth -= 149;
                var a = 1 + (lenth / this.size1);
                if (a >= 3) {
                    a = 3;
                }
                if (this.scaleX < 3) {
                    egret.Tween.get(this).to({ scaleX: a + 0.3, scaleY: a + 0.3 }, 300).to({ scaleX: a - 0.15, scaleY: a - 0.15 }, 250).to({ scaleX: a + 0.15, scaleY: a + 0.15 }, 180).to({ scaleX: a - 0.1, scaleY: a - 0.1 }, 130).to({ scaleX: a, scaleY: a }, 100);
                }
                //虚影
                // meterAanimation.getInstance().playAnimation(0, 0,"lv" + this.level.toString(), "armatureName", "slow");
                // var froglogu = meterAanimation.getInstance().getArmart();
                // this.addChild(froglogu);
                // this.setChildIndex(froglogu, 1)
                // froglogu.x = this.frogAniamtionDis.x;
                // froglogu.y = this.frogAniamtionDis.y;
                // this.changeClothes.changeClothes(froglogu, this.type, this.level);
                // egret.Tween.get(this).to({scaleX:1+(lenth/1000),scaleY:1+(lenth/1000)},500)
                //  froglogu.scaleX=froglogu.scaleY=0.35
                //  egret.Tween.get(froglogu).to({alpha:0},500).call(()=>{
                // 	this.removeChild(froglogu);
                //  })
            }
            else {
                lenth -= 149;
                this.scaleX = this.scaleY = 1 + (lenth / 1000);
            }
        };
        //快要断线了
        frogNet.prototype.changeFaceEye = function (faceTppe, linemax) {
            if (this.qineyer != faceTppe && this.qineyer != 4 && this.qineyer != 3) {
                this.qineyer = faceTppe;
                if (faceTppe == 1 || faceTppe == 0) {
                    if (this.eyetime == -1) {
                        //FrogEyesManage.GetInstance().ChangeEyes(this.frogAniamtionDis, faceTppe, this.leftEye, this.rightEye);
                    }
                }
                else {
                    this.eyetime = Date.now();
                    //FrogEyesManage.GetInstance().ChangeEyes(this.frogAniamtionDis, faceTppe, this.leftEye, this.rightEye);
                    if (faceTppe == 2) {
                        this.MovieClipPlay(4);
                        //this.MovieClipPlay(8);//测试帧动画
                    }
                }
            }
        };
        frogNet.prototype.born = function (userid, name, x, y, frogType, levle, dressup) {
            if (userid == DataProl.shadowFrogId) {
                this.alpha = 0.5;
            }
            this.x = x;
            this.y = y;
            this.frogAnimationInit();
            this.frogAniamtionDis = meterAanimation.getInstance().GetDragonAnimation(1);
            this.addChild(this.frogAniamtionDis);
            this.setChildIndex(this.frogAniamtionDis, 0);
            this.userid = userid;
            this.username = name;
            this.type = 0;
            this.mainLevel = 1;
            this.minLevel = 1;
            this.ClipLayer.removeChildren(); //清除所有在ClipLayer层上的动画
            this.nowPropsType = [-1, -1, -1, -1, -1, -1, -1, -1, -1];
            this.displayEffectOfProps(this.nowPropsType);
            /**初始化时换装  防止颜色出错*/
            FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);
            if (dressup != null) {
                if (dressup.decorateId > 0) {
                    this.changeShipin("shipin_" + (dressup.decorateId - 1000));
                }
                if (dressup.trailingId > 0) {
                    this.frogTrailing(dressup.trailingId - 2000);
                }
            }
            // console.log("zhaungban   " + dressup.decorateId);
            // this.changeShipin("shipin_"+3);
            // this.frogTrailing(2);
            //this.setFrogName(this.userid.toString());
            this.setFrogName(this.username.toString());
            this.visible = true;
            this.isUsed = true;
            if (this.frogTrai)
                this.frogTrai.visible = true;
            if (userid == DataProl.account && webNetworkMananger.getInstance().gameSceneRec) {
                webNetworkMananger.getInstance().gameSceneRec.myUser.userSprit = this;
                webNetworkMananger.getInstance().gameSceneRec.camera.setTarget(this);
            }
            if (this.userid == DataProl.account) {
                this.OnresetShadowFogPoint(this);
            }
        };
        /**青蛙显示 */
        frogNet.prototype.frogShow = function () {
            this.visible = true;
        };
        /**设置青蛙的名字 */
        frogNet.prototype.setFrogName = function (nameStr) {
            if (nameStr == null || this.frogName == null)
                return;
            this.frogName.visible = true;
            var DisLen = gameGlobal.global.frogShowNameLength;
            var name = nameStr.length > DisLen ? nameStr.substring(0, DisLen) : nameStr;
            this.frogName.text = name;
            this.frogName.width = 220;
            if (this.userid == DataProl.account)
                this.frogName.textColor = 0xe3fe03;
        };
        frogNet.prototype.getdistance = function (x, y) {
            return Math.sqrt(x * x + y * y);
        };
        /**初始化名字 */
        frogNet.prototype.displayFrogName = function () {
            var _this = this;
            this.frogName = new eui.Label();
            this.frogName.fontFamily = "Microsoft YaHei";
            this.frogName.width = 60;
            this.frogName.height = 40;
            this.frogName.anchorOffsetX = this.frogName.width / 2;
            this.frogName.anchorOffsetY = this.frogName.height / 2;
            this.effectOfProps.anchorOffsetX = this.effectOfProps.width / 2;
            this.effectOfProps.anchorOffsetY = this.effectOfProps.height / 2;
            this.effectOfProps.scaleX = this.effectOfProps.scaleY = 3;
            this.frogName.textAlign = egret.HorizontalAlign.CENTER;
            this.frogName.verticalAlign = egret.VerticalAlign.MIDDLE;
            this.gamePanleHandle.addChild(this.frogName);
            this.gamePanleHandle.addChild(this.effectOfProps);
            this.frogName.visible = true;
            var nameTimer = new egret.Timer(10, -1);
            nameTimer.addEventListener(egret.TimerEvent.TIMER, function (e) {
                _this.frogName.x = _this.x - 70;
                _this.frogName.y = _this.y - 90;
                _this.effectOfProps.x = _this.x + 10;
                _this.effectOfProps.y = _this.y - 120;
            }, this);
            nameTimer.start();
        };
        /**播放玩家死亡动画 */
        frogNet.prototype.frogDied = function () {
            if (this.isUsed == false)
                return;
            //this.frogAniamtionDis.armature.animation.play("death");
            FrogReloadingSystem.GetInstance().Reloading(this.frogAniamtionDis, this.type, this.level);
            // this.frogAniamtionDis.addEventListener(dragonBones.EventObject.LOOP_COMPLETE, () => {
            // 	// if (this.userid == DataProl.account) {
            // 	// 	webNetworkMananger.getInstance().gameSceneRec.userDied.disPlayerDiedPanl();
            // 	// }
            // 	// this.reset();
            // }, this);
            if (this.userid == DataProl.account) {
                webNetworkMananger.getInstance().gameSceneRec.userDied.disPlayerDiedPanl();
            }
            this.reset();
        };
        /**
         * 播放玩家升级特效
         */
        // protected playUserUpgrade(): void {
        // 	if (!serverConfig.config.isParticleRun)
        // 		return;
        // 	if (this._texture && this._config) {
        // 		var lizi = new particle.GravityParticleSystem(this._texture, this._config);
        // 		this.addChild(lizi);
        // 		lizi.start(1);
        // 		lizi.anchorOffsetX = lizi.width / 2;
        // 		lizi.anchorOffsetY = lizi.height / 2;
        // 		lizi.x = this.frogAniamtionDis.x;
        // 		lizi.y = this.frogAniamtionDis.y;
        // 	}
        // }
        frogNet.prototype.playUserUpgrade = function (_texture, _config, x, y) {
            if (!serverConfig.config.isParticleRun)
                return;
            if (_texture && _config) {
                var lizi = new particle.GravityParticleSystem(_texture, _config);
                this.addChild(lizi);
                //this.tralingLayer.addChild(lizi);
                lizi.start(2);
                lizi.anchorOffsetX = lizi.width / 2;
                lizi.anchorOffsetY = lizi.height / 2;
                lizi.x = this.frogAniamtionDis.x + x;
                lizi.y = this.frogAniamtionDis.y + y;
            }
        };
        /**加载升级资源 */
        frogNet.prototype.loadRes = function () {
            this._texture = RES.getRes("LevelUp_png");
            this._config = RES.getRes("LevelUp_json");
        };
        /** 青蛙拖尾 */
        frogNet.prototype.frogTrailing = function (type) {
            var _this = this;
            if (!serverConfig.config.isParticleRun)
                return;
            var tuowei_Texture = RES.getRes("tuowei_" + type.toString());
            var tuowei_Config = RES.getRes("newTuowei_json");
            if (tuowei_Texture && tuowei_Config) {
                this.frogTrai = new particle.GravityParticleSystem(tuowei_Texture, tuowei_Config);
                this.tralingLayer.addChild(this.frogTrai);
                this.frogTrai.start();
                var liziTimer = new egret.Timer(100, -1);
                liziTimer.addEventListener(egret.TimerEvent.TIMER, function (e) {
                    _this.frogTrai.emitterX = _this.x;
                    _this.frogTrai.emitterY = _this.y;
                }, this);
                liziTimer.start();
            }
            if (!this.isUsed && this.frogTrai) {
                this.frogTrai.visible = false;
            }
        };
        /**弹开tween动画 */
        frogNet.prototype.flicktween = function (point) {
            this.canMove = false;
            //锁定摇杆
            this.netrolelock();
            var sX = this.scaleX;
            var sY = this.scaleY;
            //this.x=point.x;
            //this.y=point.y;
            egret.Tween.get(this).to({ scaleX: this.scaleX + 0.3, scaleY: this.scaleY + 0.3 }, 300).to({ scaleX: sX, scaleY: sY }, 300);
            egret.Tween.get(this).to({ x: point.x, y: point.y }, 600).call(this.flickcallback, this);
        };
        frogNet.prototype.flickcallback = function (e) {
            //删除所有tween动画
            egret.Tween.removeTweens(this);
            //重置影子青蛙
            if (this.userid == DataProl.account) {
                this.OnresetShadowFogPoint(this);
            }
            //解锁摇杆
            this.netunrolelock();
            this.canMove = true;
        };
        /**获取贝塞尔曲线终点*/
        frogNet.prototype.setPoint = function (pointoverX, pointoverY) {
            this.pointOver.x = pointoverX;
            this.pointOver.y = pointoverY;
        };
        Object.defineProperty(frogNet.prototype, "factor", {
            /**获取贝塞尔曲线控制点 */
            get: function () {
                return 0;
            },
            /**定位贝塞尔曲线控制点 */
            set: function (value) {
                this.x = (1 - value) * (1 - value) * this.x + 2 * value * (1 - value) * (this.x + this.pointOver.x) / 2 + value * value * (this.pointOver.x);
                this.y = (1 - value) * (1 - value) * this.y + 2 * value * (1 - value) * (this.y + this.pointOver.y) / 2 + value * value * (this.pointOver.y);
            },
            enumerable: true,
            configurable: true
        });
        /**青蛙舔到道具移动 */
        frogNet.prototype.lickProp = function (pointoverX, pointoverY) {
            this.canMove = false;
            //设置曲线终点--目前为直线
            this.setPoint(pointoverX, pointoverY);
            //记录自己的大小，用于落地时还原
            var sX = this.scaleX;
            var sY = this.scaleY;
            //tween动画
            egret.Tween.get(this).to({ scaleX: this.scaleX + 0.5, scaleY: this.scaleY + 0.5 }, 300).to({ scaleX: sX, scaleY: sY }, 300).call(this.callback, this);
            egret.Tween.get(this).to({ factor: 1 }, 2000);
            //锁定摇杆
            this.netrolelock();
        };
        /**tween动画回调 */
        frogNet.prototype.callback = function (e) {
            egret.Tween.removeTweens(this);
            //重置影子青蛙
            if (this.userid == DataProl.account) {
                this.OnresetShadowFogPoint(this);
            }
            this.canMove = true;
            //解锁摇杆
            this.netunrolelock();
        };
        /**锁定摇杆*/
        frogNet.prototype.netrolelock = function () {
            //获取当前游戏场景
            if (this.m_frogMgr.gameHandle != null && this.m_frogMgr.gameHandle != undefined) {
                var gamesence = this.m_frogMgr.gameHandle;
                //获取摇杆
                if (gamesence.yaogan != null) {
                    this.m_frogMgr.gameHandle.yaogan.lockControl();
                }
            }
        };
        /**解锁摇杆 */
        frogNet.prototype.netunrolelock = function () {
            //获取当前游戏场景
            if (this.m_frogMgr.gameHandle != null && this.m_frogMgr.gameHandle != undefined) {
                //获取摇杆
                var gamesence = this.m_frogMgr.gameHandle;
                if (gamesence.yaogan != null) {
                    this.m_frogMgr.gameHandle.yaogan.unlockControl();
                }
            }
        };
        return frogNet;
    }(control.frog));
    control.frogNet = frogNet;
    __reflect(frogNet.prototype, "control.frogNet");
})(control || (control = {}));
/**青蛙动画换装系统 */
var FrogReloadingSystem = (function () {
    /**构造 */
    function FrogReloadingSystem() {
        /**换装部位 */
        this.changeParts = ["weiba", "tou", "youhou", "zuohou", "youqian", "zuoqian"];
    }
    /**获取单例对象 */
    FrogReloadingSystem.GetInstance = function () {
        if (this.frogReloadingSystemSole == null) {
            this.frogReloadingSystemSole = new FrogReloadingSystem();
        }
        return this.frogReloadingSystemSole;
    };
    /**换装（解析数据）
     * @param animationObj 动画对象
     * @param type 颜色
     * @param level 等级
     */
    FrogReloadingSystem.prototype.Reloading = function (animationObj, type, level) {
        /**主要等级 */
        var mainLevel = Math.floor(level / 10);
        /**换装部位名字 */
        var changePartsName;
        /**当前循环等级 */
        var nowLevel;
        /**龙骨对象 */
        var armature = animationObj.armature;
        /**本等级部位是否有 */
        var isHaveByNowClass;
        /**插槽 */
        var slot;
        for (var i = 0; i < this.changeParts.length; i++) {
            changePartsName = null;
            nowLevel = null;
            isHaveByNowClass = true;
            //6个等级
            for (var j = 1; j < 7; j++) {
                nowLevel = mainLevel * 10 + j;
                changePartsName = this.changeParts[i] + nowLevel;
                slot = armature.getSlot(changePartsName);
                if (slot == null) {
                    if (nowLevel == level) {
                        isHaveByNowClass = false;
                    }
                    continue;
                }
                else {
                    if (nowLevel != level) {
                        slot.visible = false;
                    }
                    else {
                        slot.visible = true;
                        slot.displayIndex = type;
                    }
                }
            }
            //如果没有本等级的插槽，换前等级的插槽
            if (!isHaveByNowClass) {
                for (var k = level % 10; k >= 1; k--) {
                    nowLevel = mainLevel * 10 + k;
                    changePartsName = this.changeParts[i] + nowLevel;
                    slot = armature.getSlot(changePartsName);
                    if (slot == null) {
                        continue;
                    }
                    else {
                        slot.visible = true;
                        slot.displayIndex = type;
                        break;
                    }
                }
            }
        }
    };
    return FrogReloadingSystem;
}());
__reflect(FrogReloadingSystem.prototype, "FrogReloadingSystem");
/**
 * 道具类
 */
var prop = (function (_super) {
    __extends(prop, _super);
    function prop(game) {
        var _this = _super.call(this) || this;
        _this.c = serverConfig.config;
        _this.propId = -1;
        _this.gameHandle = game;
        return _this;
    }
    /**道具初始化 */
    prop.prototype.propInit = function () {
        this.propSprit = new eui.Image();
        this.addChild(this.propSprit);
        this.propSprit.x = this.x = 0;
        this.propSprit.y = this.y = 0;
        this.tweenover = new egret.Point(0, 0);
        this.tweenstart = new egret.Point(0, 0);
        this.propSprit.scaleX = this.propSprit.scaleY = gameGlobal.global.propsScal;
        this.visible = this.isUsed = false;
        this.isInRange = true;
        this.leafimg = RES.getRes("invite_adorn1");
        this.isInTween = false;
    };
    prop.prototype.update = function () {
        this.checkInRange();
    };
    prop.prototype.propBron = function (resName, x, y, id) {
        this.x = x;
        this.y = y;
        this.propId = id;
        this.propSprit.texture = RES.getRes(resName);
        this.propSprit.anchorOffsetX = this.propSprit.width / 2;
        this.propSprit.anchorOffsetY = this.propSprit.height / 2;
        this.propSprit.scaleX = this.propSprit.scaleY = 1;
        //this.effectOfProps(Math.floor(Math.random() * 10 + 0));
        this.gameHandle.displayProps.addChild(this);
        this.visible = this.isUsed = true;
        this.isInTween = false;
    };
    /**随机生成的荷叶 */
    prop.prototype.leafBron = function (x, y, id, grade) {
        this.x = x;
        this.y = y;
        this.propId = id;
        this.propSprit.texture = this.leafimg;
        this.propSprit.anchorOffsetX = this.propSprit.width / 2;
        this.propSprit.anchorOffsetY = this.propSprit.height / 2;
        this.leafsize(this, grade);
        //this.effectOfProps(Math.floor(Math.random() * 10 + 0));
        this.gameHandle.displayProps.addChild(this);
        this.visible = this.isUsed = true;
    };
    /**生成荷叶并播放动画 */
    prop.prototype.leafBronTween = function (overx, overy, id, startx, starty, grade) {
        var tmp = this;
        if (this.isInTween) {
            return;
        }
        this.isInTween = true;
        //清空所有动画
        egret.Tween.removeTweens(this);
        //记录荷叶开始和结束位置 用于判断是否是同一个荷叶
        this.tweenstart.x = startx;
        this.tweenstart.y = starty;
        this.tweenover.x = overx;
        this.tweenover.y = overy;
        //将荷叶当前位置设置为动画开始位置
        this.x = this.tweenstart.x;
        this.y = this.tweenstart.y;
        this.propId = id;
        this.propSprit.texture = this.leafimg;
        this.propSprit.anchorOffsetX = this.propSprit.width / 2;
        this.propSprit.anchorOffsetY = this.propSprit.height / 2;
        //设置荷叶大小
        this.leafsize(this, grade);
        this.gameHandle.displayProps.addChild(this);
        this.visible = this.isUsed = true;
        egret.Tween.get(this).to({ x: overx, y: overy }, 500).call(function (e) { tmp.isInTween = false; });
    };
    prop.prototype.setInRange = function (isRange) {
        this.isInRange = isRange;
    };
    prop.prototype.checkInRange = function () {
        if (DataProl.isXinShou) {
            return;
        }
        // if (this.isInRange == this.isInRangeLast) {
        // 	return;
        // }
        // else {
        this.checkProp();
        this.visible = this.isInRange;
        // }
    };
    prop.prototype.checkProp = function () {
        var my = webNetworkMananger.getInstance().gameSceneRec.m_createAllFrogs.findFrogById(DataProl.account);
        if (my == null || my == undefined) {
            return;
        }
        var rangeEye = this.c.rangeEye;
        if (!my.deathDate) {
            if (MathUtils.distance(this.x, this.y, my.x, my.y) < rangeEye) {
                this.isInRange = true;
            }
            else {
                this.isInRange = false;
            }
        }
    };
    /**荷叶大小判断 */
    prop.prototype.leafsize = function (leaf, grade) {
        if (grade == 2) {
            this.propSprit.scaleX = this.propSprit.scaleY = 0.5;
        }
        if (grade == 5) {
            this.propSprit.scaleX = this.propSprit.scaleY = 0.7;
        }
        if (grade == 20) {
            this.propSprit.scaleX = this.propSprit.scaleY = 0.9;
        }
        if (grade >= 50) {
            this.propSprit.scaleX = this.propSprit.scaleY = 1.3;
        }
    };
    prop.prototype.propRecover = function () {
        this.visible = this.isUsed = false;
        this.gameHandle.displayProps.removeChild(this);
        this.propId = -1;
        this.propSprit.texture = null;
        this.x = this.y = 0;
        egret.Tween.removeTweens(this.propSprit);
        this.isInTween = false;
    };
    /**道具显示效果
     * 0 顺时针旋转
     * 1 逆时针旋转
    */
    prop.prototype.effectOfProps = function (type) {
        var scal = gameGlobal.global.propsScal;
        egret.Tween.get(this.propSprit, { loop: true }).to({ rotation: (type > 5 ? 359 : -359) }, 36000);
        egret.Tween.get(this.propSprit, { loop: true }).to({ scaleX: scal - 0.1, scaleY: scal - 0.1 }, 1000).to({ scaleX: scal, scaleY: scal }, 1000);
    };
    return prop;
}(eui.Component));
__reflect(prop.prototype, "prop");
/**
 * 道具管理类
 */
var propMgr = (function (_super) {
    __extends(propMgr, _super);
    function propMgr(gameProps) {
        var _this = _super.call(this) || this;
        /**道具容器 */
        _this.props = [];
        /**初始化道具数量 */
        _this.propCountInit = 100;
        _this.displayProps = gameProps;
        _this.init();
        return _this;
    }
    propMgr.prototype.init = function () {
        this.props = [];
        for (var t = 0; t < this.propCountInit; t++) {
            this.creatOneProps();
        }
    };
    propMgr.prototype.creatOneProps = function () {
        var oneProp = new prop(this);
        oneProp.propInit();
        this.props.push(oneProp);
    };
    propMgr.prototype.getOneProps = function () {
        for (var t = 0; t < this.props.length; t++) {
            if (this.props[t].isUsed == false)
                return this.props[t];
        }
        /**如果都在使用 创建一个 */
        this.creatOneProps();
        return this.props[this.props.length - 1];
    };
    /**道具更新 */
    propMgr.prototype.propsUpdata = function (propsData) {
        //console.log("道具容器长度："+this.props.length);
        this.checkServer(propsData);
        this.checkClick(propsData);
        /**道具是否在视野内 不在就不显示 */
        for (var t = 0; t < this.props.length; t++) {
            for (var i = 0; i < propsData.length; i++) {
                if (this.props[t].x == propsData[i].x && this.props[t].y == propsData[i].y) {
                    this.props[t].setInRange(propsData[i].isInRange);
                }
            }
            this.props[t].update();
        }
    };
    /**检查需要添加的 */
    propMgr.prototype.checkServer = function (propsData) {
        for (var t = 0; t < propsData.length; t++) {
            var nowProp = propsData[t];
            var propHave = this.clientHaveProps(nowProp);
            if (!propHave) {
                var prop = this.getOneProps();
                if (webNetworkMananger.isServerMove) {
                    this.multcreateprop(prop, nowProp);
                }
                else {
                    this.singlecreateprop(prop, nowProp);
                }
            }
        }
    };
    /**联网模式生成道具 */
    propMgr.prototype.multcreateprop = function (prop, nowProp) {
        //7青蛙死亡生成的荷叶
        if (nowProp.type == 7) {
            prop.leafBronTween(nowProp.point.x, nowProp.point.y, nowProp.id, nowProp.pointfrom.x, nowProp.pointfrom.y, nowProp.value);
        }
        else if (nowProp.type == 6) {
            prop.leafBron(nowProp.point.x, nowProp.point.y, nowProp.id, nowProp.value);
        }
        else {
            prop.propBron("daoju" + nowProp.type, nowProp.point.x, nowProp.point.y, nowProp.id);
        }
    };
    /**单机模式生成道具 */
    propMgr.prototype.singlecreateprop = function (prop, nowProp) {
        if (nowProp.type == 7) {
            //7青蛙死亡生成的荷叶
            prop.leafBronTween(nowProp.x, nowProp.y, nowProp.id, nowProp.tweenx, nowProp.tweeny, nowProp.grade);
        }
        else if (nowProp.type == 6) {
            prop.leafBron(nowProp.x, nowProp.y, nowProp.id, nowProp.grade);
        }
        else {
            prop.propBron("daoju" + nowProp.type, nowProp.x, nowProp.y, nowProp.id);
        }
    };
    /**检查需要删除的 */
    propMgr.prototype.checkClick = function (propsData) {
        var _this = this;
        var displayProps = this.displayProps.$children;
        displayProps.forEach(function (e) {
            var needDelet = _this.serverHaveProp(e, propsData);
            if (!needDelet)
                e.propRecover();
        });
    };
    /**本地是否有道具 */
    propMgr.prototype.clientHaveProps = function (pro) {
        var returnData = false;
        this.props.forEach(function (e) {
            if (webNetworkMananger.isServerMove) {
                if (pro.type != 7) {
                    if (e.x == pro.point.x && e.y == pro.point.y) {
                        returnData = true;
                    }
                }
                if (pro.type == 7) {
                    if (e.tweenstart.x == pro.pointfrom.x && e.tweenstart.y == pro.pointfrom.y && e.tweenover.x == pro.point.x && e.tweenover.y == pro.point.y) {
                        returnData = true;
                    }
                }
            }
            else {
                if (e.x == pro.x && e.y == pro.y) {
                    returnData = true;
                }
                if (pro.type == 7)
                    if (e.tweenstart.x == pro.tweenx && e.tweenstart.y == pro.tweeny && e.tweenover.x == pro.x && e.tweenover.y == pro.y) {
                        returnData = true;
                    }
            }
        });
        return returnData;
    };
    /**服务器是否有道具 */
    propMgr.prototype.serverHaveProp = function (propId, propsData) {
        for (var t = 0; t < propsData.length; t++) {
            //	if (propsData[t].id == propId)
            if (webNetworkMananger.isServerMove) {
                //服务器发送送的数据并不是每次都有pointfrom，避免报空
                if (propsData[t].type != 7) {
                    if (propsData[t].point.x == propId.x && propsData[t].point.y == propId.y) {
                        return true;
                    }
                }
                if (propsData[t].type == 7) {
                    if (propsData[t].pointfrom.x == propId.tweenstart.x && propsData[t].pointfrom.y == propId.tweenstart.y && propsData[t].point.x == propId.tweenover.x && propsData[t].point.y == propId.tweenover.y) {
                        return true;
                    }
                }
            }
            else {
                if (propsData[t].x == propId.x && propsData[t].y == propId.y) {
                    return true;
                }
                if (propsData[t].tweenx == propId.tweenstart.x && propsData[t].tweeny == propId.tweenstart.y && propsData[t].x == propId.tweenover.x && propsData[t].y == propId.tweenover.y) {
                    return true;
                }
            }
        }
        return false;
    };
    return propMgr;
}(eui.Component));
__reflect(propMgr.prototype, "propMgr");
var resManager = (function () {
    function resManager() {
        this.ress = [];
        this.isInit = false;
        this.eyeString = [
            "eyeyou_0",
            "eyeyou_1",
            "eyeyou_2",
            "eyeyou_3",
            "eyeyou_4",
            "eyezuo_0",
            "eyezuo_1",
            "eyezuo_2",
            "eyezuo_3",
            "eyezuo_4",
            "eye_5_png",
        ];
        this.expressionRes = [];
        this.expressionString = [
            "ice_2_png",
            "heixian_png",
            "han_png",
            "eye_black_png",
            "eye_22_png",
            "zhuangtai_1",
            "bowen",
            "shipin_1",
            "shipin_2",
            "shipin_3",
            "shipin_4",
            "shipin_5",
            "eye_1",
            "shetou",
            "shadow_png",
            "hudun_wai",
            "hudun_nei",
            "mojing",
        ];
        this.leveupStringress = [];
        this.leveupString = [
            "LevelUp_png",
            "LevelUp_json",
            "_ske_json",
            "_tex_json",
            "_tex_png"
        ];
    }
    resManager.getInstance = function () {
        if (this.instance == null) {
            this.instance = new resManager();
        }
        return this.instance;
    };
    resManager.prototype.loadRes = function () {
        if (this.isInit) {
            console.log("加载过了");
            return;
        }
        this.isInit = true;
        this.loadFrogEyeRes();
        this.loadLeveUpRes();
        this.loadFrogExpressionRes();
    };
    //眼睛变化
    resManager.prototype.loadFrogEyeRes = function () {
        for (var i = 0; i < this.eyeString.length; i++) {
            this.initResCache(this.eyeString[i], this.ress);
        }
    };
    resManager.prototype.loadFrogExpressionRes = function () {
        for (var i = 0; i < this.expressionString.length; i++) {
            this.initResCache(this.expressionString[i], this.expressionRes);
        }
    };
    /*在此处缓存加载资源*/
    resManager.prototype.initResCache = function (name, list) {
        var obj = RES.getRes(name);
        list.push(obj);
    };
    resManager.prototype.loadLeveUpRes = function () {
        for (var i = 0; i < this.leveupString.length; i++) {
            this.initResCache(this.leveupString[i], this.leveupStringress);
        }
    };
    resManager.prototype.getLeveUpRes = function (index) {
        if (this.leveupStringress.length == 0) {
            console.log("数组长度为空");
            return;
        }
        if (index > this.leveupStringress.length) {
            console.log("数组长度越界" + index + 'dd' + this.ress.length);
            return;
        }
        return this.leveupStringress[index];
    };
    resManager.prototype.getResGroups = function (index) {
        if (this.ress.length == 0) {
            console.log("数组长度为空");
            return;
        }
        if (index > this.ress.length) {
            console.log("数组长度越界" + index + 'dd' + this.ress.length);
            return;
        }
        return this.ress[index];
    };
    resManager.prototype.getExpressionGroups = function (index) {
        if (this.expressionRes.length == 0) {
            console.log("数组长度为空");
            return;
        }
        if (index > this.expressionRes.length) {
            console.log("数组长度越界" + index + 'dd' + this.expressionRes.length);
            return;
        }
        return this.expressionRes[index];
    };
    return resManager;
}());
__reflect(resManager.prototype, "resManager");
//////////////////////////////////////////////////////////////////////////////////////
//
//  Copyright (c) 2014-present, Egret Technology.
//  All rights reserved.
//  Redistribution and use in source and binary forms, with or without
//  modification, are permitted provided that the following conditions are met:
//
//     * Redistributions of source code must retain the above copyright
//       notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above copyright
//       notice, this list of conditions and the following disclaimer in the
//       documentation and/or other materials provided with the distribution.
//     * Neither the name of the Egret nor the
//       names of its contributors may be used to endorse or promote products
//       derived from this software without specific prior written permission.
//
//  THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
//  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
//  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
//  IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
//  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
//  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
//  OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
//  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
//  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
//  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////////////
var Main = (function (_super) {
    __extends(Main, _super);
    function Main() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Main.prototype.createChildren = function () {
        _super.prototype.createChildren.call(this);
        // egret.ImageLoader.crossOrigin = "anonymous";
        egret.lifecycle.addLifecycleListener(function (context) {
            // custom lifecycle plugin
        });
        egret.lifecycle.onPause = function () {
            egret.ticker.pause();
        };
        egret.lifecycle.onResume = function () {
            egret.ticker.resume();
        };
        //inject the custom material parser
        //注入自定义的素材解析器
        var assetAdapter = new AssetAdapter();
        egret.registerImplementation("eui.IAssetAdapter", assetAdapter);
        egret.registerImplementation("eui.IThemeAdapter", new ThemeAdapter());
        //微信分享
        platform.showShareMenu();
        // initialize the Resource loading library
        //初始化Resource资源加载库
        RES.loadConfig("default.res.json", "resource/");
        //RES.loadConfig("default.res.json", "https://praying715.cn/download/resource/");
        //RES.loadConfig("default.res.json", "http://172.16.18.54:6600/download/resource/");
        //console.log("开始资源加载中");
        RES.addEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
    };
    /**
       * 配置文件加载完成,开始预加载皮肤主题资源和preload资源组。
       * Loading of configuration file is complete, start to pre-load the theme configuration file and the preload resource group
       */
    Main.prototype.onConfigComplete = function (event) {
        //console.log("添加资源侦听");
        RES.removeEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
        RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this);
        RES.addEventListener(RES.ResourceEvent.GROUP_LOAD_ERROR, this.onResourceLoadError, this);
        RES.addEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this);
        RES.addEventListener(RES.ResourceEvent.ITEM_LOAD_ERROR, this.onItemLoadError, this);
        RES.loadGroup("preload");
    };
    Main.prototype.init = function () {
        GlobalData.GameStage = this.stage;
        GlobalData.GameStage_width = this.stage.stageWidth; //egret.MainContext.instance.stage.stageWidth;
        GlobalData.GameStage_height = this.stage.stageHeight; //egret.MainContext.instance.stage.stageHeight;
    };
    /* 主题文件加载完成,开始预加载
  * Loading of theme configuration file is complete, start to pre-load the
  */
    Main.prototype.onThemeLoadComplete = function () {
        this.theme.removeEventListener(eui.UIEvent.COMPLETE, this.onThemeLoadComplete, this);
        RES.loadGroup("loading");
    };
    /**
       * preload资源组加载完成
       * preload resource group is loaded
       */
    Main.prototype.onResourceLoadComplete = function (event) {
        if (event.groupName == "preload") {
            // console.log("资源组" + event.groupName + "加载完成");
            //加载皮肤主题配置文件,可以手动修改这个文件。替换默认皮肤。
            this.theme = new eui.Theme("resource/default.thm.json", this.stage);
            this.theme.addEventListener(eui.UIEvent.COMPLETE, this.onThemeLoadComplete, this);
        }
        else if (event.groupName == "loading") {
            // console.log("资源组" + event.groupName + "加载完成");
            RES.loadGroup("game");
        }
        else if (event.groupName == "game") {
            // console.log("资源组" + event.groupName + "加载完成");
            this.init();
            //this.addChild(new LoginMain());
            //UIManager.getInstance().startGame();
            SceneManager.instance.setStage(this);
            SceneManager.instance.SitchScene(SceneName.登录场景);
            this.clear();
        }
    };
    Main.prototype.clear = function () {
        // console.log("清除资源侦听");
        RES.removeEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this);
        RES.removeEventListener(RES.ResourceEvent.GROUP_LOAD_ERROR, this.onResourceLoadError, this);
        RES.removeEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this);
        RES.removeEventListener(RES.ResourceEvent.ITEM_LOAD_ERROR, this.onItemLoadError, this);
        this.theme = null;
    };
    /**
     * 资源组加载出错
     *  The resource group loading failed
     */
    Main.prototype.onItemLoadError = function (event) {
        console.warn("Url:" + event.resItem.url + " has failed to load");
    };
    /**
     * 资源组加载出错
     * Resource group loading failed
     */
    Main.prototype.onResourceLoadError = function (event) {
        //TODO
        console.warn("Group:" + event.groupName + " has failed to load");
        //忽略加载失败的项目
        //ignore loading failed projects
        this.onResourceLoadComplete(event);
    };
    /**
     * preload资源组加载进度
     * loading process of preload resource
     */
    Main.prototype.onResourceProgress = function (event) {
    };
    return Main;
}(eui.UILayer));
__reflect(Main.prototype, "Main");
var tongue = (function (_super) {
    __extends(tongue, _super);
    function tongue() {
        var _this = _super.call(this) || this;
        _this.isUsed = false;
        //舌头图片
        _this.tongueObj = new eui.Image();
        //舌结图片
        _this.tongueKnot = new eui.Image();
        /**线数据 坐标*角度*宽度 */
        _this.lineData = null;
        _this.lineMax = null;
        _this.linebili = null;
        _this.userOneId = null;
        _this.userTwoId = null;
        _this.init();
        return _this;
    }
    /**初始化 */
    tongue.prototype.init = function () {
        this.tongueObjInit();
        this.tongueKnotInit();
        this.height = 100;
        this.visible = false;
        this.texture0 = RES.getRes("shetou_0");
        this.texture1 = RES.getRes("shetou_1");
        this.texture2 = RES.getRes("shetou_2");
        this.texture3 = RES.getRes("shetou_3");
    };
    //舌头初始化 
    tongue.prototype.tongueObjInit = function () {
        //this.tongueObj.texture = RES.getRes("shetou_0");
        this.tongueObj.texture = this.texture0;
        this.addChild(this.tongueObj);
        this.tongueObj.anchorOffsetY = this.tongueObj.height / 2;
        this.tongueObj.anchorOffsetX = this.tongueObj.width / 2;
        this.tongueObj.x = this.tongueObj.y = 0;
    };
    //舌结初始化
    tongue.prototype.tongueKnotInit = function () {
        this.tongueKnot.texture = RES.getRes("shejie");
        this.addChild(this.tongueKnot);
        this.tongueKnot.anchorOffsetY = this.tongueKnot.height / 2;
        this.tongueKnot.anchorOffsetX = this.tongueKnot.width / 2;
        this.tongueKnot.x = this.tongueKnot.y = 0;
    };
    //舌头的出生 给定出现的位置、使用舌头的两只青蛙id以及舌头的最大长度
    tongue.prototype.born = function (lineData, userOneId, userTwoId) {
        this.lineData = lineData;
        this.userOneId = userOneId;
        this.userTwoId = userTwoId;
        this.isUsed = this.visible = true;
        this.lineUpdata();
    };
    //重置舌头
    tongue.prototype.reset = function () {
        this.lineData = null;
        this.userOneId = null;
        this.userTwoId = null;
        this.visible = this.isUsed = false;
    };
    /**实时改变舌头的状态 */
    tongue.prototype.updateTongueData = function (lineData, linemax) {
        this.lineData.lineLenth = lineData.lineLenth;
        this.lineData.postion = lineData.postion;
        this.lineData.rotation = lineData.rotation;
        this.lineData.type = lineData.type;
        this.lineMax = linemax;
        this.lineUpdata();
    };
    /**随舌长改变舌头粗细 */
    tongue.prototype.TongueProportion = function (textureName) {
        if (textureName == "shetou_0") {
            this.tongueObj.texture = this.texture0;
        }
        else if (textureName == "shetou_1") {
            this.tongueObj.texture = this.texture1;
        }
        else if (textureName == "shetou_2") {
            this.tongueObj.texture = this.texture2;
        }
        else if (textureName == "shetou_3") {
            this.tongueObj.texture = this.texture3;
        }
        //this.tongueObj.texture = RES.getRes(textureName);
        //this.width = this.tongueObj.width = this.lineData.lineLenth - 100;
        if (this.lineMax > this.tongueObj.width) {
            this.linebili = (this.lineMax - this.tongueObj.width) / this.lineMax;
            this.linebili += 0.6;
            if (this.linebili <= 0.1) {
                this.linebili = 0.1;
            }
        }
        this.tongueObj.height = 24 * this.linebili;
        this.tongueObj.anchorOffsetY = this.tongueObj.height / 2;
    };
    /**调整线的位置、角度 */
    tongue.prototype.lineUpdata = function () {
        if (this.lineData.type == 1) {
            this.alpha = 0.05;
        }
        else {
            this.alpha = 1;
        }
        this.x = this.lineData.postion.x;
        this.y = this.lineData.postion.y;
        this.rotation = this.lineData.rotation + 90;
        //this.width = this.tongueObj.width = this.lineData.lineLenth - 100;//00修改,当this.lineData.lineLenth<100时，会导致新生成的舌头很长
        if (this.lineData.lineLenth > 80) {
            this.lineData.lineLenth -= 80;
        }
        this.tongueObj.width = this.lineData.lineLenth;
        this.width = this.tongueObj.width;
        this.tongueObj.anchorOffsetX = this.tongueObj.width / 2;
        if (this.tongueObj.width <= this.lineMax * 0.5) {
            this.tongueObj.texture = this.texture0;
            this.tongueObj.height = 24;
            this.tongueObj.anchorOffsetY = this.tongueObj.height / 2;
        }
        else if (this.tongueObj.width <= this.lineMax * 0.65) {
            this.TongueProportion("shetou_1");
        }
        else if (this.tongueObj.width <= this.lineMax * 0.8) {
            this.TongueProportion("shetou_2");
        }
        else {
            this.TongueProportion("shetou_3");
        }
    };
    return tongue;
}(eui.Component));
__reflect(tongue.prototype, "tongue");
var tongueMgr = (function (_super) {
    __extends(tongueMgr, _super);
    function tongueMgr(game, frogMgr) {
        var _this = _super.call(this) || this;
        /**舌头对象池 */
        _this.tonguePool = [];
        /**对象池中舌头的总数量 */
        _this.MaxCount = 20;
        _this.tongueTimer = new egret.Timer(1000 / 60, 0);
        /**红心表情是否存在 */
        _this.happeFaceBool = false;
        _this.gameHandle = game;
        _this.m_frogMgr = frogMgr;
        _this.init();
        return _this;
    }
    /**对象池初始化 */
    tongueMgr.prototype.init = function () {
        this.addTongueIntoPool();
        this.tongueTimer.addEventListener(egret.TimerEvent.TIMER, this.updataTongue, this);
        this.tongueTimer.start();
    };
    /**向对象池中添加指定数量的舌头对象 */
    tongueMgr.prototype.addTongueIntoPool = function () {
        for (var i = 0; i < this.MaxCount; i++) {
            this.createOneTongue();
        }
    };
    /**生成一个舌头 */
    tongueMgr.prototype.createOneTongue = function () {
        var tongueObj = new tongue();
        this.tonguePool.push(tongueObj);
        this.gameHandle.addChild(tongueObj);
    };
    //从对象池中获取一个舌头
    tongueMgr.prototype.getOneTongue = function () {
        var tongue = null;
        for (var i = 0; i < this.tonguePool.length; i++) {
            if (!this.tonguePool[i].isUsed) {
                tongue = this.tonguePool[i];
                break;
            }
        }
        if (tongue == null) {
            console.log("线池中没线....");
            //	this.createOneTongue();
            tongue = this.tonguePool.length - 1;
        }
        return tongue;
    };
    /**舌头数据更新 */
    tongueMgr.prototype.gameTongueDataUpdata = function (userData, lineData) {
        this.nowServerAllLine = lineData;
        this.userData = userData;
        if (lineData.length == 0) {
            this.resetAllTongue();
            return;
        }
        this.lineUpdata();
    };
    /**更新线/检查删除和增加*/
    tongueMgr.prototype.lineUpdata = function () {
        /**检查需要删除的 */
        for (var t = 0; t < this.tonguePool.length; t++) {
            if (this.isCheckLineNeedRemove(this.tonguePool[t])) {
                //	this.addOneLineye(this.tonguePool[t]);
                this.tonguePool[t].reset();
            }
        }
        /**检查需要添加的 */
        for (var t = 0; t < this.nowServerAllLine.length; t++) {
            if (this.isCheckLineNeedAdd(this.nowServerAllLine[t])) {
                this.addOneLin(this.nowServerAllLine[t]);
            }
        }
    };
    /**检查线是否需要删除*/
    tongueMgr.prototype.isCheckLineNeedRemove = function (line) {
        for (var t = 0; t < this.nowServerAllLine.length; t++) {
            /**判断是否由当前线 */
            if ((this.nowServerAllLine[t].userOneId == line.userOneId && this.nowServerAllLine[t].userTwoId == line.userTwoId))
                return false;
            else if (this.nowServerAllLine[t].userOneId == line.userTwoId && (this.nowServerAllLine[t].userTwoId == line.userOneId))
                return false;
        }
        return true;
    };
    /**检查是否需要添加线 */
    tongueMgr.prototype.isCheckLineNeedAdd = function (line) {
        for (var t = 0; t < this.tonguePool.length; t++) {
            /**判断是否由当前线 */
            if ((this.tonguePool[t].userOneId == line.userOneId && this.tonguePool[t].userTwoId == line.userTwoId))
                return false;
            else if (this.tonguePool[t].userOneId == line.userTwoId && (this.tonguePool[t].userTwoId == line.userOneId))
                return false;
        }
        return true;
    };
    tongueMgr.prototype.happeFaceBoolChange = function () {
        this.happeFaceBool = false;
    };
    /**添加一条线 */
    tongueMgr.prototype.addOneLin = function (oneLineData) {
        var tongue_1 = this.getOneTongue();
        var startPos = this.m_frogMgr.findFrogById(oneLineData.userOneId);
        var endPos = this.m_frogMgr.findFrogById(oneLineData.userTwoId);
        if (endPos != null && startPos != null) {
            startPos.changeFaceEye(2, null);
            endPos.changeFaceEye(2, null);
            this.happeFaceBool = true;
            egret.setTimeout(function (arg) {
                this.happeFaceBool = false;
            }, this, 2000);
        }
        if (startPos == null) {
            startPos = oneLineData.uop;
        }
        if (endPos == null) {
            endPos = oneLineData.utp;
        }
        var newLineData = this.getOneLineData(startPos, endPos);
        tongue_1.born(newLineData, oneLineData.userOneId, oneLineData.userTwoId);
    };
    /**更新一条线 */
    tongueMgr.prototype.updataTongue = function () {
        var startPos;
        var endPos;
        var jv;
        var nowLineData;
        var TongueMax;
        var newLineData;
        var tongueTmp;
        for (var i = 0; i < this.tonguePool.length; i++) {
            tongueTmp = this.tonguePool[i];
            if (tongueTmp.isUsed == false) {
                continue;
            }
            startPos = this.m_frogMgr.findFrogById(tongueTmp.userOneId);
            endPos = this.m_frogMgr.findFrogById(tongueTmp.userTwoId);
            if (startPos == null || endPos == null) {
                if (startPos != null) {
                    startPos.frogIsHadLine = false;
                }
                if (endPos != null) {
                    endPos.frogIsHadLine = false;
                }
                tongueTmp.reset();
                return;
            }
            else {
                jv = startPos.frogLineLength + endPos.frogLineLength;
                if (Util.getInstance().getDistance(startPos, endPos) > jv * 0.8) {
                    //	nowLineData = this.getOneLineData(startPos, endPos);
                    /**快断线眼 */
                    startPos.changeFaceEye(0, jv);
                    endPos.changeFaceEye(0, jv);
                    //FaceManager.GetInstance().ChangeWinkEyes(startPos,startPos.leftEye,startPos.RightEye);
                    //FaceManager.GetInstance().ChangeWinkEyes(endPos,startPos.leftEye,startPos.RightEye);
                }
                else {
                    startPos.changeFaceEye(1, null);
                    endPos.changeFaceEye(1, null);
                }
                //
                // 	if (!this.happeFaceBool) {
                // 	//	startPos.changeFaceEye(1, null);
                // 	//	endPos.changeFaceEye(1, null);
                // 	}
                // }
            }
            TongueMax = startPos.frogLineLength + endPos.frogLineLength; //00修改获取舌头的最大长度
            newLineData = this.getOneLineData(startPos, endPos);
            tongueTmp.updateTongueData(newLineData, TongueMax);
        }
        // this.tonguePool.forEach(e => {
        // 	if (e.isUsed) {
        // 		startPos = this.m_frogMgr.findFrogById(e.userOneId);
        // 		endPos = this.m_frogMgr.findFrogById(e.userTwoId);
        // 		if (endPos != null && startPos != null) {
        // 			jv = startPos.frogLineLength + endPos.frogLineLength;
        // 			if (Util.getInstance().getDistance(startPos, endPos) > jv * 0.8) {//监听并判断线长//00修改，原jv - 150改为0.7*jv
        // 				nowLineData = this.getOneLineData(startPos, endPos);
        // 				startPos.changeFaceEye(0, jv);
        // 				endPos.changeFaceEye(0, jv)
        // 			}
        // 			else {
        // 				if (!this.happeFaceBool) {
        // 					startPos.changeFaceEye(1, null);
        // 					endPos.changeFaceEye(1, null);
        // 				}
        // 			}
        // 		}
        // 		if (startPos == null)
        // 			startPos = this.findTonguePosInServer(e);
        // 		if (endPos == null)
        // 			endPos = this.findTonguePosInServer(e);
        // 		if (endPos == null || startPos == null)
        // 			return;
        // 		TongueMax = startPos.frogLineLength + endPos.frogLineLength;//00修改获取舌头的最大长度
        // 		newLineData = this.getOneLineData(startPos, endPos);
        // 		e.updateTongueData(newLineData, TongueMax);
        // 	}
        // });
    };
    /**根据起始坐标获取线所需要的信息 */
    tongueMgr.prototype.getOneLineData = function (startPos, endPos) {
        return {
            type: startPos.nowPropsType,
            postion: Util.getInstance().getCenterPos(startPos, endPos),
            rotation: Util.getInstance().getRotation(startPos, endPos),
            lineLenth: Util.getInstance().getDistance(startPos, endPos),
        };
    };
    //根据id查找服务器上舌头的位置
    tongueMgr.prototype.findTonguePosInServer = function (e) {
        var data = null;
        for (var i = 0; i < this.nowServerAllLine.length; i++) {
            if (this.nowServerAllLine[i].userOneId == e.userOneId && this.nowServerAllLine[i].userTwoId == e.userTwoId) {
                data = { uop: this.nowServerAllLine[i].uop, utp: this.nowServerAllLine[i].utp };
            }
            else if (this.nowServerAllLine[i].userOneId == e.userTwoId && this.nowServerAllLine[i].userTwoId == e.userOneId) {
                data = { uop: this.nowServerAllLine[i].utp, utp: this.nowServerAllLine[i].uop };
            }
        }
        if (data == null) {
            console.log("服务器上一次发送过来的lineData中竟然没有这个舌头");
            //没有这个舌头**舌头初始化
            e.reset();
        }
        return data;
    };
    //重置所有的舌头
    tongueMgr.prototype.resetAllTongue = function () {
        this.tonguePool.forEach(function (e) {
            if (e.isUsed) {
                e.reset();
            }
        });
    };
    return tongueMgr;
}(eui.Component));
__reflect(tongueMgr.prototype, "tongueMgr");
var MathUtils = (function () {
    function MathUtils() {
        MathUtils.dir = egret.Point.create(0, 0);
    }
    MathUtils.getPointSideOfLine = function (ptstart, ptend, pt) {
        var side = ptend.x; // (((ptstart.y – ptend.y) * pt.x) + ((ptend.x – ptstart.x) * pt.y) + (ptstart.x * ptend.y) – (ptend.x * ptstart.y));
        return side;
    };
    MathUtils.getDistanceBetweenPoints = function (ptstart, ptend) {
        var dis = egret.Point.distance(ptstart, ptend);
        return dis;
    };
    MathUtils.getRandomDirInRange = function (offsetAngle1, offsetAngle2) {
        if (MathUtils.dir == undefined) {
            MathUtils.dir = egret.Point.create(0, 0);
        }
        var angle = MathUtils.RandomRange(offsetAngle1, offsetAngle2) * Math.PI / 180;
        this.dir.setTo(Math.sin(angle), Math.cos(angle));
        this.dir.normalize(1);
        return this.dir;
    };
    MathUtils.getRandomDir = function () {
        if (MathUtils.dir == undefined) {
            MathUtils.dir = egret.Point.create(0, 0);
        }
        var angle = Math.random() * 360 * Math.PI / 180;
        this.dir.setTo(Math.sin(angle), Math.cos(angle));
        this.dir.normalize(1);
        return this.dir;
    };
    MathUtils.calculateNextPoint = function (pos, dir, speed) {
        dir.normalize(speed);
        pos = pos.add(dir);
        return { x: pos.x, y: pos.y };
    };
    MathUtils.calculateNextPointEx = function (curX, curY, dirX, dirY, speed, output) {
        this.NextPointdir.setTo(dirX, dirY);
        this.NextPointpos.setTo(curX, curX);
        this.NextPointdir.normalize(speed);
        //     if(output)
        //   console.log( "原来的位置" + curX +"|"+curY + "移动方向" + dirX +"|"+dirY + "新位置" +pos.x +"|" + pos.y );
        return { x: this.NextPointdir.x + this.NextPointpos.x, y: this.NextPointdir.y + this.NextPointpos.y };
    };
    MathUtils.RandomRange = function (down, up) {
        return down + Math.random() * (up - down);
    };
    MathUtils.double_equals = function (a, b) {
        return Math.abs(a - b) < MathUtils.ZERO;
    };
    MathUtils.distance_sqr = function (x1, y1, x2, y2) {
        return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
    };
    MathUtils.distance = function (x1, y1, x2, y2) {
        return Math.sqrt(this.distance_sqr(x1, y1, x2, y2));
    };
    MathUtils.getAngle = function (x0, y0, x1, y1, x2, y2) {
        var dsx = x1 - x0;
        var dsy = y1 - y0;
        var dex = x2 - x0;
        var dey = y2 - y0;
        var cosfi = dsx * dex + dsy * dey;
        var norm = (dsx * dsx + dsy * dsy) * (dex * dex + dey * dey);
        cosfi /= Math.sqrt(norm);
        if (cosfi >= 1.0)
            return 0;
        if (cosfi <= -1.0)
            return Math.PI;
        var fi = Math.acos(cosfi);
        return 180 * fi / Math.PI;
    };
    MathUtils.getAngleEx = function (x1, y1, x2, y2) {
        //两点的x、y值
        var x = x2 - x1;
        var y = y2 - y1;
        var z = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
        //斜边长度
        var cos = x / z;
        var radian = Math.acos(cos);
        //求出弧度
        var angle = 180 / (Math.PI / radian);
        //用弧度算出角度       
        if (y < 0) {
            angle = -angle;
        }
        else if ((y == 0) && (x < 0)) {
            angle = 180;
        }
        return angle;
    };
    MathUtils.Dot = function (x1, y1, x2, y2) {
        var ret = x1 * x2 + y1 * y2;
        if (ret >= -0) {
            return true;
        }
        return false;
    };
    MathUtils.getOnePointOnLine = function (x1, y1, x2, y2) {
        var pt = { x: 0, y: 0 };
        var radom = Math.random();
        pt.x = x1 + (x2 - x1) * radom;
        pt.y = y1 + (y2 - y1) * radom;
        return pt;
    };
    MathUtils.getOnePointOnLineAt = function (x1, y1, x2, y2, rate) {
        var pt = { x: 0, y: 0 };
        var radom = Math.random();
        pt.x = x1 + (x2 - x1) * rate;
        pt.y = y1 + (y2 - y1) * rate;
        return pt;
    };
    MathUtils.getCircleInsect = function (x1, y1, r1, x2, y2, r2) {
        var insectInfo = { insectType: 0, angle: 0, arg1: 0, arg2: 0 }; //insectType 0 -任意移动  1-向对方点移动 2-限定角度移动， -1，没办法了怎么移动都没用
        /*&   var shp:egret.Shape = new egret.Shape();
            shp.graphics.lineStyle( 2, 0x00ff00 );
            shp.graphics.moveTo( x1,y1 );
            shp.graphics.lineTo( x2,y2 );
            shp.graphics.drawCircle(x1,y1,r1);
            shp.graphics.drawCircle(x2,y2,r2);*/
        if (MathUtils.double_equals(x1, x2)
            && MathUtils.double_equals(y1, y2)
            && MathUtils.double_equals(r1, r2)) {
            //  console.log("随便跑");
            insectInfo.insectType = 0;
            return insectInfo;
        }
        //无交点  
        var d = this.distance(x1, y1, x2, y2);
        // console.log("跑, 距离" + d);
        if (d > r1 + r2) {
            // console.log("算不出来焦点了");
            insectInfo.insectType = -1;
            return insectInfo;
        }
        if (d < Math.abs(r1 - r2)) {
            // console.log("第一个人的位置" + x1 + "|" + y1 + "移动半径" + r1 + "第二个人的位置" + x2 + "|" + y2 + "线长" + r2);
            //  console.log("随便跑, 距离" + d + "距离差" + (r1 - r2));
            insectInfo.insectType = 0;
            return insectInfo;
        }
        var a = 2.0 * r1 * (x1 - x2);
        var b = 2.0 * r1 * (y1 - y2);
        var c = r2 * r2 - r1 * r1 - this.distance_sqr(x1, y1, x2, y2);
        var p = a * a + b * b;
        var q = -2.0 * a * c;
        //一个交点
        if (this.double_equals(d, r1 + r2)
            || this.double_equals(d, Math.abs(r1 - r2))) {
            //console.log("一个交点");
            insectInfo.insectType = 1;
            insectInfo.arg1 = x2 - x1;
            insectInfo.arg2 = y2 - y1;
            return insectInfo;
        }
        //两个交点
        var r = c * c - b * b;
        var cos_value1 = (Math.sqrt(q * q - 4.0 * p * r) - q) / p / 2.0;
        var cos_value2 = (-Math.sqrt(q * q - 4.0 * p * r) - q) / p / 2.0;
        var sin_value1 = Math.sqrt(1 - cos_value1 * cos_value1);
        var sin_value2 = Math.sqrt(1 - cos_value2 * cos_value2);
        var pt1 = { x: 0, y: 0 };
        var pt2 = { x: 0, y: 0 };
        pt1.x = r1 * cos_value1 + x1;
        pt1.y = r1 * sin_value1 + y1;
        pt2.x = r1 * cos_value2 + x1;
        pt2.y = r1 * sin_value2 + y1;
        if (!this.double_equals(this.distance_sqr(pt1.x, pt1.y, x2, y2), r2 * r2)) {
            pt1.y = y1 - r1 * sin_value1;
        }
        if (!this.double_equals(this.distance_sqr(pt2.x, pt2.y, x2, y2), r2 * r2)) {
            pt2.y = y1 - r1 * sin_value2;
        }
        if (this.double_equals(y1, y2)
            && this.double_equals(x1, x2)) {
            if (pt1.y > 0) {
                pt2.y = -pt2.y;
            }
            else {
                pt1.y = -pt1.y;
            }
        }
        /*  shp.graphics.lineStyle( 2, 0xff0000 );
            shp.graphics.moveTo( x1,y1 );
            shp.graphics.lineTo( pt1.x,pt1.y );
     
            shp.graphics.moveTo( x1,y1 );
            shp.graphics.lineTo( pt2.x,pt2.y );*/
        insectInfo.insectType = 2;
        var pt3 = MathUtils.getOnePointOnLine(pt1.x, pt1.y, pt2.x, pt2.y);
        var dir = egret.Point.create(0, 0);
        dir.x = pt3.x - x1;
        dir.y = pt3.y - y1;
        if (!MathUtils.Dot(dir.x, dir.y, x2 - x1, y2 - y1)) {
            dir.x = -dir.x;
            dir.y = -dir.y;
        }
        dir.normalize(1);
        /*     shp.graphics.lineStyle( 2, 0xff0000 );
            shp.graphics.moveTo( x1,y1 );
             shp.graphics.lineTo(x1+  dir.x*50,y1+dir.y*50 );
                shp.graphics.endFill();
             singleGame.ins.addChild(shp);*/
        insectInfo.arg1 = dir.x;
        insectInfo.arg2 = dir.y;
        //   console.log("第一个人的位置" + x1 + "|" + y1 + "移动半径" + r1 + "第二个人的位置" + x2 + "|" + y2 + "线长" + r2 + "相交类型" + insectInfo.insectType + "参数" + insectInfo.arg1 + "," + insectInfo.arg2);
        /*	var nextPointOne = MathUtils.calculateNextPointEx(x1,y1, dir.x, dir.y,r1,true );
            
            var distance = (x2- nextPointOne.x) * (x2- nextPointOne.x)  + (y2 - nextPointOne.y) * (y2- nextPointOne.y);
            if(Math.sqrt(distance) >r2)
            {
                    console.log("矫正过后的距离" + Math.sqrt(distance));
            }
        */
        return insectInfo;
    };
    MathUtils.getFootfallPoint = function (x1, y1, x2, y2, x, y) {
        var a = (y1 - y2) / ((x1 - x2) == 0 ? 1 : x1 - x2);
        var b = y1 - a * y1;
        var m = x + a * y;
        var pt = { x: 0, y: 0 };
        pt.x = (m - a * b) / (a * a + 1);
        pt.y = (a * pt.x) + b;
        return pt;
    };
    MathUtils.getFootfallDistance = function (x1, y1, x2, y2, x, y) {
        var a = (y1 - y2) / ((x1 - x2) < 0.05 ? 0.05 : (x1 - x2));
        var b = y1 - a * y1;
        /// > 0 = ax +b -y;  
        return Math.abs(a * x + b - y / Math.sqrt(a * a + 1));
    };
    MathUtils.checkPointOnSegment = function (x1, y1, x2, y2, x, y) {
        var max_x = x1 > x2 ? x1 : x2;
        var min_x = x1 < x2 ? x1 : x2;
        var max_y = y1 > y2 ? y1 : y2;
        var min_y = y1 < y2 ? y1 : y2;
        if (x >= min_x && x <= max_x && y >= min_y && y <= max_y)
            return true;
        return false;
    };
    MathUtils.NextPointdir = new egret.Point(0, 0);
    MathUtils.NextPointpos = new egret.Point(0, 0);
    MathUtils.ZERO = 1e-9; //误差，小于这个就当作0
    return MathUtils;
}());
__reflect(MathUtils.prototype, "MathUtils");
/**
 * 游戏商城数据类
 */
var gameShopData = (function (_super) {
    __extends(gameShopData, _super);
    function gameShopData() {
        var _this = _super.call(this) || this;
        /**商品管理类 */
        _this.m_gameShopMgr = new gameShopView(_this);
        _this.nowDisplayType = null;
        _this.skinName = "resource/assets/skins/ShopMall.exml";
        _this.init();
        return _this;
    }
    /**获取单例对象 */
    gameShopData.getInstance = function () {
        if (this.instance == null) {
            this.instance = new gameShopData();
        }
        return this.instance;
    };
    gameShopData.prototype.init = function () {
        var _this = this;
        this.m_gameShopMgr.init();
        this.getUserMoney();
        this.noClick.touchEnabled = true;
        this.closeShop.touchEnabled = true;
        this.closeShop.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
            _this.parent.removeChild(_this);
            _this.pifu_tan.visible = false;
            SoundManager.getInstance().playEffectSound("onClick_mp3");
        }, this);
        this.getUserAdress();
        this.ornamentButton.touchEnabled = true;
        this.ornamentButton.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
            _this.changeDisplayShopType(0);
            SoundManager.getInstance().playEffectSound("onClick_mp3");
        }, this);
        this.trailingButton.touchEnabled = true;
        this.trailingButton.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
            _this.changeDisplayShopType(1);
            SoundManager.getInstance().playEffectSound("onClick_mp3");
        }, this);
        //this.fenxiangBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.fen, this)
    };
    // /**点击分享 */
    // public fen() {
    // 	SoundManager.getInstance().playEffectSound(true,"onClick_mp3");
    // 	console.log("点击分享");
    // 	weixinManager.getInstance().clikShare()
    // 	MiniNet.post(DataProl.shopaddr, '/shop_share', 'accountId=' + DataProl.account, this, this.getUserMoneyCallBack);
    // }
    /**获取玩家金币 */
    gameShopData.prototype.getUserMoney = function () {
        MiniNet.post(DataProl.shopaddr, '/shop_GetUserMoney', 'accountId=' + DataProl.account, this, this.getUserMoneyCallBack);
    };
    /**获取玩家金币回调 */
    gameShopData.prototype.getUserMoneyCallBack = function (Data) {
        var userMoneyData = JSON.parse(Data.target.response);
        DataProl.userCurrentDressUp.userMoney = userMoneyData.usermoney;
        this.showMoney();
    };
    /**显示玩家金币 */
    gameShopData.prototype.showMoney = function () {
        this.usermoney.text = DataProl.userCurrentDressUp.userMoney + "";
    };
    /**获取全部商品回调 */
    gameShopData.prototype.allShopCallBack = function () {
        this.m_gameShopMgr.serverAllGoods(GlobalData.shopsData);
        this.getMineData();
        GlobalData.isGetShop = 1;
    };
    /**
     * 向服务器获取玩家的背包
     */
    gameShopData.prototype.getMineData = function () {
        MiniNet.post(DataProl.shopaddr, '/shop_GetUserShop', 'accountId=' + DataProl.account, this, this.mineShopsBack);
    };
    /**
     * 获取背包回调
     */
    gameShopData.prototype.mineShopsBack = function (shopsData) {
        this.m_gameShopMgr.ownDataDispos(JSON.parse(shopsData.target.response));
        /**显示所有商品 */
        if (this.nowDisplayType == null)
            this.m_gameShopMgr.displayGoods(0);
        else {
            this.m_gameShopMgr.displayGoods(this.nowDisplayType);
            this.nowDisplayType = null;
        }
    };
    /**购买商品 */
    gameShopData.prototype.buyGoods = function (shopId, goodstype, zpiont) {
        var _this = this;
        this.nowDisplayType = goodstype;
        this.pifu_tan.visible = true;
        this.pifu_tan.x = zpiont.x + 225;
        this.pifu_tan.y = zpiont.y + 140;
        this.biankuang.scaleY = 0;
        this.biankuang.scaleX = 2;
        this.need_chengjiu.visible = false;
        this.wen.visible = false;
        this.gold.visible = false;
        egret.Tween.get(this.biankuang).to({ scaleX: 1, scaleY: 0.05 }, 200).to({ scaleY: 1 }, 100).call(function () {
            _this.need_chengjiu.visible = true;
            _this.wen.visible = true;
            _this.gold.visible = true;
            _this.pifu_tan.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
                _this.need_chengjiu.visible = false;
                _this.wen.visible = false;
                _this.gold.visible = false;
                egret.Tween.get(_this.biankuang).to({ scaleX: 1, scaleY: 0.05 }, 100).to({ scaleX: 2, scaleY: 0 }, 200).call(function () {
                    _this.pifu_tan.visible = false;
                });
            }, _this);
        });
        if (goodstype == 0) {
            this.need_chengjiu.texture = RES.getRes("chengjiuxunzhang_" + (shopId % 10).toString());
        }
        else {
            this.need_chengjiu.texture = RES.getRes("chengjiuxunzhang_" + ((shopId % 10) + 5 > 7 ? 7 : (shopId % 10) + 5).toString());
        }
        console.log("///////////*********" + shopId % 10);
        //this.shops.setChildIndex(this.pifu_tan,15);
        console.log("//////////***********////" + goodstype + "///////////*********" + shopId);
        MiniNet.post(DataProl.shopaddr, '/shop_addUserShop', 'accountId=' + DataProl.account + '&shopId=' + shopId, this, this.buyGoodsCallBack);
        console.log(this.usermoney);
    };
    /**购买商品回调 */
    gameShopData.prototype.buyGoodsCallBack = function (data) {
        var buyData = JSON.parse(data.target.response);
        if (buyData.usermoney != null) {
            DataProl.userCurrentDressUp.userMoney = buyData.usermoney;
        }
        this.showMoney();
        /**购买成功 */
        if (buyData.isBuy) {
            this.setActionByShopAction(buyData.goodsId, 1);
            this.getMineData();
        }
        else {
            this.pifu_tan.visible = true;
        }
    };
    /**获取玩家当前装扮 */
    gameShopData.prototype.getUserAdress = function () {
        MiniNet.post(DataProl.shopaddr, '/shop_getUserAdressUp', 'accountId=' + DataProl.account, this, this.userAdressCallBack);
    };
    /**获取玩家装扮回调 */
    gameShopData.prototype.userAdressCallBack = function (date) {
        var dressUp = JSON.parse(date.target.response);
        DataProl.userCurrentDressUp.decorateId = dressUp.dressData[0].DecorateId;
        DataProl.userCurrentDressUp.trailingId = dressUp.dressData[0].TrailingId;
        DataProl.userCurrentDressUp.userMoney = dressUp.dressData[0].userMoney;
        DataProl.userCurrentDressUp.sign = dressUp.dressData[0].sign;
    };
    /**操作商品  装备/卸下 */
    gameShopData.prototype.operatingMerchandise = function (shopId) {
        this.initializeShop();
        /**是否穿戴当前商品 >=0为拥有 */
        if (shopId == DataProl.userCurrentDressUp.decorateId || shopId == DataProl.userCurrentDressUp.trailingId) {
            this.unloadDecoration(shopId);
        }
        else
            this.putOnTheDecoration(shopId);
    };
    /**初始化商店 */
    gameShopData.prototype.initializeShop = function () {
        var shopsData = this.shops.$children;
        shopsData.forEach(function (e) {
            if (e.isHave == true) {
                e.changeShopAction(1);
            }
        });
    };
    /**穿上装饰 */
    gameShopData.prototype.putOnTheDecoration = function (shopId) {
        // console.log("玩家穿上装饰 " + shopId);
        if (shopId >= 2000) {
            DataProl.userCurrentDressUp.trailingId = shopId;
        }
        else {
            /**大于0代表已经穿上装饰了 */
            DataProl.userCurrentDressUp.decorateId = shopId;
        }
        this.setActionByShopAction(shopId, 2);
        this.updataAdressUp();
        MiniNet.post(DataProl.shopaddr, '/shop_getUserAdressUp', 'accountId=' + DataProl.account, this, this.userAdressCallBack);
    };
    /**卸下装饰 */
    gameShopData.prototype.unloadDecoration = function (shopId) {
        console.log("玩家卸下装饰 " + shopId);
        if (shopId >= 2000) {
            DataProl.userCurrentDressUp.trailingId = -1;
        }
        else {
            DataProl.userCurrentDressUp.decorateId = -1;
        }
        this.setActionByShopAction(shopId, 1);
        this.updataAdressUp();
    };
    /**更新玩家装扮 */
    gameShopData.prototype.updataAdressUp = function () {
        var data = 'accountId=' + DataProl.account + '&decorateId=' + DataProl.userCurrentDressUp.decorateId + '&trailingId=' + DataProl.userCurrentDressUp.trailingId;
        MiniNet.post(DataProl.shopaddr, '/shop_updataAdressUp', data, this, this.buyGoodsCallBack);
    };
    /**根据商品动作下标设置商品动作 */
    gameShopData.prototype.setActionByShopAction = function (shopId, ActionIndex) {
        if (shopId == null)
            return;
        var shopsData = this.shops.$children;
        shopsData.forEach(function (e) {
            if (e.name == shopId.toString()) {
                if (ActionIndex == 1)
                    e.isHave = true;
                e.changeShopAction(ActionIndex);
            }
        });
    };
    /**切换显示商品类型 */
    gameShopData.prototype.changeDisplayShopType = function (showType) {
        this.pifu_tan.visible = false;
        this.shops.removeChildren();
        this.ornamentButton.textColor = showType == 0 ? 0x8aff00 : 0xFFFFFF;
        this.trailingButton.textColor = showType == 1 ? 0x8aff00 : 0xFFFFFF;
        this.m_gameShopMgr.displayGoods(showType);
    };
    /**分享成功 */
    gameShopData.shareSuccess = function () {
        var data = 'accountId=' + DataProl.account;
        MiniNet.post(DataProl.shopaddr, '/user_shareSuccess', data, this, null);
    };
    return gameShopData;
}(eui.Component));
__reflect(gameShopData.prototype, "gameShopData");
/**
 * 游戏商城显示类
 */
var gameShopView = (function (_super) {
    __extends(gameShopView, _super);
    function gameShopView(game) {
        var _this = _super.call(this) || this;
        /**全部商品 */
        _this.allShopData = [];
        _this.userBag = [];
        _this.gameHandle = game;
        return _this;
    }
    gameShopView.prototype.init = function () {
        this.allShopShow = this.gameHandle.shops;
        this.gameHandle.allShopCallBack();
    };
    /**显示商品
     * shopType 商品类型 装饰/拖尾
     */
    gameShopView.prototype.displayGoods = function (shopType) {
        var allGoods = this.allShopData;
        var shops = [];
        shops = this.allShopData.filter(function (e) {
            if (e.goodsType == shopType)
                return e;
        });
        for (var t = 0; t < shops.length; t++) {
            if (shops[t].goodsType == shopType) {
                var shopPoint = this.getPositionByIndex(t);
                shops[t].DisplayShops(shopPoint.x, shopPoint.y);
                this.allShopShow.addChild(shops[t]);
            }
        }
        this.displayHaveGoods();
    };
    /**获取商品位置 */
    gameShopView.prototype.getPositionByIndex = function (t) {
        var startPoint = { x: 120, y: 100 };
        return {
            "x": (t % 3 == 3 || t % 3 == 0) ? startPoint.x : startPoint.x + (t % 3) * 210,
            "y": t / 3 == 0 ? startPoint.y : startPoint.y + Math.floor(t / 3) * 210
        };
    };
    /**玩家的背包数据处理 */
    gameShopView.prototype.ownDataDispos = function (ownData) {
        this.userBag = ownData.shopData;
    };
    /**显示已有商品 */
    gameShopView.prototype.displayHaveGoods = function () {
        if (this.userBag == null)
            return;
        var playerOwnData = this.userBag;
        for (var t = 0; t < playerOwnData.length; t++) {
            this.allShopData.forEach(function (e) {
                if (playerOwnData[t].forGoodsId == e.shopId) {
                    e.isHave = true;
                    if (DataProl.userCurrentDressUp.decorateId == e.shopId ||
                        DataProl.userCurrentDressUp.trailingId == e.shopId)
                        e.changeShopAction(2);
                    else
                        e.changeShopAction(1);
                }
            });
        }
    };
    /**服务器上的所有商品 */
    gameShopView.prototype.serverAllGoods = function (allGoods) {
        for (var t = 0; t < allGoods.length; t++) {
            var oneShop = new goods(this);
            oneShop.dataInit(allGoods[t]);
            oneShop.init();
            this.allShopData.push(oneShop);
        }
    };
    return gameShopView;
}(eui.Component));
__reflect(gameShopView.prototype, "gameShopView");
/**
 * 商品类
 */
var goods = (function (_super) {
    __extends(goods, _super);
    function goods(game) {
        var _this = _super.call(this) || this;
        /**商品类型 */
        _this.disGoodsType = ["shipin", "tuowei"];
        /**点击商品动作 */
        _this.GoodsAction = ["goumai", "chuandai", "xiexia"];
        /**是否拥有 */
        _this.isHave = false;
        _this.colo = [
            [
                0.33, 0.33, 0.33, 0, 0,
                0.33, 0.33, 0.33, 0, 0,
                0.33, 0.33, 0.33, 0, 0,
                0, 0, 0, 1, 0
            ], [
                1, 0, 0, 0, 0,
                0, 1, 0, 0, 0,
                0, 0, 1, 0, 0,
                0, 0, 0, 1, 0
            ]
        ];
        _this.gameHandle = game;
        return _this;
    }
    /**  商品初始化*/
    goods.prototype.init = function () {
        this.width = 163;
        this.height = 187;
        this.setShopBg();
        this.setShopImage();
        this.setShopName();
        this.setShopButton();
        this.setShopPrice();
        this.setClickButtonEvent();
    };
    goods.prototype.DisplayShops = function (_X, _Y) {
        this.x = _X;
        this.y = _Y;
        if (this.isHave == true) {
            this.changeShopAction(1);
        }
    };
    /**商品是否解锁 */
    goods.prototype.unlock = function (aa) {
        if (this.isHave) {
            var colorFlilter = new egret.ColorMatrixFilter(this.colo[1]);
        }
        else {
            var colorFlilter = new egret.ColorMatrixFilter(this.colo[0]);
        }
        aa.filters = [colorFlilter];
    };
    /**设置商品背景 */
    goods.prototype.setShopBg = function () {
        this.disGoodsBg = this.loadingImage("shangpinkuang", 0, 0, 166, 166);
        /**商品背景 */
        this.addChild(this.disGoodsBg);
        this.unlock(this.disGoodsBg);
    };
    /**设置商品图片 */
    goods.prototype.setShopImage = function () {
        this.disGoodsImage = this.loadingImage(this.resName, 0, 0, 100, 50);
        /**商品图片 */
        this.addChild(this.disGoodsImage);
        this.unlock(this.disGoodsImage);
    };
    /**设置商品名字 */
    goods.prototype.setShopName = function () {
        this.disGoodsName = this.loadingLabel(this.goodsName, 0, -68, 131, 35, 0, 20);
        /**商品名字 */
        this.addChild(this.disGoodsName);
        this.unlock(this.disGoodsName);
    };
    /**设置商品按钮 */
    goods.prototype.setShopButton = function () {
        this.disGoodsButton = this.loadingImage(this.GoodsAction[0], 0, 80, 120, 58);
        /**商品操作 */
        this.addChild(this.disGoodsButton);
    };
    /**设置商品价格 */
    goods.prototype.setShopPrice = function () {
        this.disGoodsPrice = this.loadingLabel("解锁", 15, 77, 111, 33, -5, 22);
        this.disGoodsGold = this.loadingImage("golds", -40, 72, 48, 50);
        //关闭触碰
        this.disGoodsGold.touchEnabled = false;
        /**商品金币 */
        this.addChild(this.disGoodsGold);
        /**商品价格 */
        this.addChild(this.disGoodsPrice);
    };
    /**设置商品点击事件 */
    goods.prototype.setClickButtonEvent = function () {
        var _this = this;
        this.disGoodsPrice.touchEnabled = false;
        this.disGoodsButton.touchEnabled = true;
        this.disGoodsButton.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
            SoundManager.getInstance().playEffectSound("onClick_mp3");
            egret.Tween.get(_this.disGoodsButton).to({ scaleX: 0.7, scaleY: 0.7 }, 100).to({ scaleX: 1, scaleY: 1 }, 100);
            egret.Tween.get(_this.disGoodsPrice).to({ scaleX: 0.7, scaleY: 0.7 }, 100).to({ scaleX: 1, scaleY: 1 }, 100);
            if (DataProl.userCurrentDressUp.userMoney >= 100) {
                console.log(DataProl.userCurrentDressUp.userMoney + "购买成功！");
                DataProl.userCurrentDressUp.userMoney -= 100;
            }
            else {
                console.log(DataProl.userCurrentDressUp.userMoney + "购买失败！");
            }
            if (!_this.isHave) {
                var fashezhuo = new egret.Point(_this.x, _this.y);
                _this.gameHandle.gameHandle.buyGoods(_this.shopId, _this.goodsType, fashezhuo);
            }
            else
                _this.gameHandle.gameHandle.operatingMerchandise(_this.shopId);
        }, this);
    };
    /**改变点击商品动作显示 */
    goods.prototype.changeShopAction = function (actionIndex) {
        this.disGoodsPrice.text = "";
        this.disGoodsGold.visible = false;
        this.disGoodsButton.texture = RES.getRes(this.GoodsAction[actionIndex]);
    };
    /**
    * resName 资源名字
    * x/y 坐标
    * width/heigth 尺寸
    */
    goods.prototype.loadingImage = function (resName, _x, _y, width, heigth) {
        var Image = new eui.Image();
        Image.texture = RES.getRes(resName);
        Image.width = width;
        Image.height = heigth;
        Image.x = _x;
        Image.y = _y;
        Image.anchorOffsetX = Image.width / 2;
        Image.anchorOffsetY = Image.height / 2;
        return Image;
    };
    /**
     * content 内容
     */
    goods.prototype.loadingLabel = function (content, _x, _y, width, heigth, rotation, size) {
        var Label = new eui.Label(content);
        Label.x = _x;
        Label.y = _y;
        // Label.width = width;
        // Label.height = heigth;
        Label.rotation = rotation;
        Label.size = size;
        Label.anchorOffsetX = Label.width / 2;
        Label.anchorOffsetY = Label.height / 2;
        Label.textAlign = egret.HorizontalAlign.CENTER;
        Label.verticalAlign = egret.VerticalAlign.MIDDLE;
        Label.fontFamily = "Microsoft YaHei";
        return Label;
    };
    /**信息初始化 */
    goods.prototype.dataInit = function (goodsData) {
        this.shopId = goodsData.shopId;
        this.name = this.shopId.toString();
        this.goodsType = goodsData.shopType;
        this.goodsPrice = goodsData.shopMoney;
        this.goodsName = goodsData.shopName;
        this.resName = goodsData.shopResName;
    };
    return goods;
}(eui.Component));
__reflect(goods.prototype, "goods");
/**
 *
 * @author
 *
 */
var Base64Util = (function () {
    function Base64Util() {
    }
    Base64Util.encode = function (data) {
        // Convert string to ByteArray
        var bytes = new egret.ByteArray();
        bytes.writeUTFBytes(data);
        // Return encoded ByteArray
        return this.encodeByteArray(bytes);
    };
    Base64Util.encodeByteArray = function (data) {
        // Initialise output
        var output = "";
        // Create data and output buffers
        var dataBuffer;
        var outputBuffer = new Array(4);
        // Rewind ByteArray
        data.position = 0;
        // while there are still bytes to be processed
        while (data.bytesAvailable > 0) {
            // Create new data buffer and populate next 3 bytes from data
            dataBuffer = new Array();
            for (var i = 0; i < 3 && data.bytesAvailable > 0; i++) {
                dataBuffer[i] = data.readUnsignedByte();
            }
            // Convert to data buffer Base64 character positions and 
            // store in output buffer
            outputBuffer[0] = (dataBuffer[0] & 0xfc) >> 2;
            outputBuffer[1] = ((dataBuffer[0] & 0x03) << 4) | ((dataBuffer[1]) >> 4);
            outputBuffer[2] = ((dataBuffer[1] & 0x0f) << 2) | ((dataBuffer[2]) >> 6);
            outputBuffer[3] = dataBuffer[2] & 0x3f;
            // If data buffer was short (i.e not 3 characters) then set
            // end character indexes in data buffer to index of '=' symbol.
            // This is necessary because Base64 data is always a multiple of
            // 4 bytes and is basses with '=' symbols.
            for (var j = dataBuffer.length; j < 3; j++) {
                outputBuffer[j + 1] = 64;
            }
            // Loop through output buffer and add Base64 characters to 
            // encoded data string for each character.
            for (var k = 0; k < outputBuffer.length; k++) {
                output += this.BASE64_CHARS.charAt(outputBuffer[k]);
            }
        }
        // Return encoded data
        return output;
    };
    Base64Util.decode = function (data) {
        // Decode data to ByteArray
        var bytes = this.decodeToByteArray(data);
        // Convert to string and return
        return bytes.readUTFBytes(bytes.length);
    };
    Base64Util.decodeToByteArray = function (data) {
        // Initialise output ByteArray for decoded data
        var output = new egret.ByteArray();
        // Create data and output buffers
        var dataBuffer = new Array(4);
        var outputBuffer = new Array(3);
        // While there are data bytes left to be processed
        for (var i = 0; i < data.length; i += 4) {
            // Populate data buffer with position of Base64 characters for
            // next 4 bytes from encoded data
            for (var j = 0; j < 4 && i + j < data.length; j++) {
                dataBuffer[j] = this.BASE64_CHARS.indexOf(data.charAt(i + j));
            }
            // Decode data buffer back into bytes
            outputBuffer[0] = (dataBuffer[0] << 2) + ((dataBuffer[1] & 0x30) >> 4);
            outputBuffer[1] = ((dataBuffer[1] & 0x0f) << 4) + ((dataBuffer[2] & 0x3c) >> 2);
            outputBuffer[2] = ((dataBuffer[2] & 0x03) << 6) + dataBuffer[3];
            // Add all non-padded bytes in output buffer to decoded data
            for (var k = 0; k < outputBuffer.length; k++) {
                if (dataBuffer[k + 1] == 64)
                    break;
                output.writeByte(outputBuffer[k]);
            }
        }
        // Rewind decoded data ByteArray
        output.position = 0;
        // Return decoded data
        return output;
    };
    Base64Util.BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    Base64Util.version = "1.0.0";
    return Base64Util;
}());
__reflect(Base64Util.prototype, "Base64Util");
/**
 *
 * @author
 *
 */
var FilterUtil = (function () {
    function FilterUtil() {
    }
    /**灰色滤镜*/
    FilterUtil.getGrayFilter = function () {
        var colorMatrix = [
            0.3, 0.6, 0, 0, 0,
            0.3, 0.6, 0, 0, 0,
            0.3, 0.6, 0, 0, 0,
            0, 0, 0, 1, 0
        ];
        var colorFlilter = new egret.ColorMatrixFilter(colorMatrix);
        return [colorFlilter];
    };
    /**模糊滤镜*/
    FilterUtil.getBlurFilter = function () {
        var blurFliter = new egret.BlurFilter(1, 1);
        return [blurFliter];
    };
    return FilterUtil;
}());
__reflect(FilterUtil.prototype, "FilterUtil");
/**
 *
 * @author
 *
 */
var md5 = (function () {
    function md5() {
        this.hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase        */
        this.b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance   */
    }
    /*
     * These are the privates you'll usually want to call
     * They take string arguments and return either hex or base-64 encoded strings
     */
    md5.prototype.hex_md5 = function (s) { return this.rstr2hex(this.rstr_md5(this.str2rstr_utf8(s))); };
    md5.prototype.b64_md5 = function (s) { return this.rstr2b64(this.rstr_md5(this.str2rstr_utf8(s))); };
    md5.prototype.any_md5 = function (s, e) { return this.rstr2any(this.rstr_md5(this.str2rstr_utf8(s)), e); };
    md5.prototype.hex_hmac_md5 = function (k, d) { return this.rstr2hex(this.rstr_hmac_md5(this.str2rstr_utf8(k), this.str2rstr_utf8(d))); };
    md5.prototype.b64_hmac_md5 = function (k, d) { return this.rstr2b64(this.rstr_hmac_md5(this.str2rstr_utf8(k), this.str2rstr_utf8(d))); };
    md5.prototype.any_hmac_md5 = function (k, d, e) { return this.rstr2any(this.rstr_hmac_md5(this.str2rstr_utf8(k), this.str2rstr_utf8(d)), e); };
    /*
     * Perform a simple self-test to see if the VM is working
     */
    md5.prototype.md5_vm_test = function () {
        return this.hex_md5("abc").toLowerCase() == "900150983cd24fb0d6963f7d28e17f72";
    };
    /*
     * Calculate the MD5 of a raw string
     */
    md5.prototype.rstr_md5 = function (s) {
        return this.binl2rstr(this.binl_md5(this.rstr2binl(s), s.length * 8));
    };
    /*
     * Calculate the HMAC-MD5, of a key and some data (raw strings)
     */
    md5.prototype.rstr_hmac_md5 = function (key, data) {
        var bkey = this.rstr2binl(key);
        if (bkey.length > 16)
            bkey = this.binl_md5(bkey, key.length * 8);
        var ipad = Array(16), opad = Array(16);
        for (var i = 0; i < 16; i++) {
            ipad[i] = bkey[i] ^ 0x36363636;
            opad[i] = bkey[i] ^ 0x5C5C5C5C;
        }
        var hash = this.binl_md5(ipad.concat(this.rstr2binl(data)), 512 + data.length * 8);
        return this.binl2rstr(this.binl_md5(opad.concat(hash), 512 + 128));
    };
    /*
     * Convert a raw string to a hex string
     */
    md5.prototype.rstr2hex = function (input) {
        try {
            this.hexcase;
        }
        catch (e) {
            this.hexcase = 0;
        }
        var hex_tab = this.hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
        var output = "";
        var x;
        for (var i = 0; i < input.length; i++) {
            x = input.charCodeAt(i);
            output += hex_tab.charAt((x >>> 4) & 0x0F)
                + hex_tab.charAt(x & 0x0F);
        }
        return output;
    };
    /*
     * Convert a raw string to a base-64 string
     */
    md5.prototype.rstr2b64 = function (input) {
        try {
            this.b64pad;
        }
        catch (e) {
            this.b64pad = '';
        }
        var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
        var output = "";
        var len = input.length;
        for (var i = 0; i < len; i += 3) {
            var triplet = (input.charCodeAt(i) << 16)
                | (i + 1 < len ? input.charCodeAt(i + 1) << 8 : 0)
                | (i + 2 < len ? input.charCodeAt(i + 2) : 0);
            for (var j = 0; j < 4; j++) {
                if (i * 8 + j * 6 > input.length * 8)
                    output += this.b64pad;
                else
                    output += tab.charAt((triplet >>> 6 * (3 - j)) & 0x3F);
            }
        }
        return output;
    };
    /*
     * Convert a raw string to an arbitrary string encoding
     */
    md5.prototype.rstr2any = function (input, encoding) {
        var divisor = encoding.length;
        var i, j, q, x, quotient;
        /* Convert to an array of 16-bit big-endian values, forming the dividend */
        var dividend = Array(Math.ceil(input.length / 2));
        for (i = 0; i < dividend.length; i++) {
            dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);
        }
        /*
         * Repeatedly perform a long division. The binary array forms the dividend,
         * the length of the encoding is the divisor. Once computed, the quotient
         * forms the dividend for the next step. All remainders are stored for later
         * use.
         */
        var full_length = Math.ceil(input.length * 8 /
            (Math.log(encoding.length) / Math.log(2)));
        var remainders = Array(full_length);
        for (j = 0; j < full_length; j++) {
            quotient = Array();
            x = 0;
            for (i = 0; i < dividend.length; i++) {
                x = (x << 16) + dividend[i];
                q = Math.floor(x / divisor);
                x -= q * divisor;
                if (quotient.length > 0 || q > 0)
                    quotient[quotient.length] = q;
            }
            remainders[j] = x;
            dividend = quotient;
        }
        /* Convert the remainders to the output string */
        var output = "";
        for (i = remainders.length - 1; i >= 0; i--)
            output += encoding.charAt(remainders[i]);
        return output;
    };
    /*
     * Encode a string as utf-8.
     * For efficiency, this assumes the input is valid utf-16.
     */
    md5.prototype.str2rstr_utf8 = function (input) {
        var output = "";
        var i = -1;
        var x, y;
        while (++i < input.length) {
            /* Decode utf-16 surrogate pairs */
            x = input.charCodeAt(i);
            y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
            if (0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF) {
                x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF);
                i++;
            }
            /* Encode output as utf-8 */
            if (x <= 0x7F)
                output += String.fromCharCode(x);
            else if (x <= 0x7FF)
                output += String.fromCharCode(0xC0 | ((x >>> 6) & 0x1F), 0x80 | (x & 0x3F));
            else if (x <= 0xFFFF)
                output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F), 0x80 | ((x >>> 6) & 0x3F), 0x80 | (x & 0x3F));
            else if (x <= 0x1FFFFF)
                output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07), 0x80 | ((x >>> 12) & 0x3F), 0x80 | ((x >>> 6) & 0x3F), 0x80 | (x & 0x3F));
        }
        return output;
    };
    /*
     * Encode a string as utf-16
     */
    md5.prototype.str2rstr_utf16le = function (input) {
        var output = "";
        for (var i = 0; i < input.length; i++)
            output += String.fromCharCode(input.charCodeAt(i) & 0xFF, (input.charCodeAt(i) >>> 8) & 0xFF);
        return output;
    };
    md5.prototype.str2rstr_utf16be = function (input) {
        var output = "";
        for (var i = 0; i < input.length; i++)
            output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF, input.charCodeAt(i) & 0xFF);
        return output;
    };
    /*
     * Convert a raw string to an array of little-endian words
     * Characters >255 have their high-byte silently ignored.
     */
    md5.prototype.rstr2binl = function (input) {
        var output = Array(input.length >> 2);
        for (var i = 0; i < output.length; i++)
            output[i] = 0;
        for (var i = 0; i < input.length * 8; i += 8)
            output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32);
        return output;
    };
    /*
     * Convert an array of little-endian words to a string
     */
    md5.prototype.binl2rstr = function (input) {
        var output = "";
        for (var i = 0; i < input.length * 32; i += 8)
            output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF);
        return output;
    };
    /*
     * Calculate the MD5 of an array of little-endian words, and a bit length.
     */
    md5.prototype.binl_md5 = function (x, len) {
        /* append padding */
        x[len >> 5] |= 0x80 << ((len) % 32);
        x[(((len + 64) >>> 9) << 4) + 14] = len;
        var a = 1732584193;
        var b = -271733879;
        var c = -1732584194;
        var d = 271733878;
        for (var i = 0; i < x.length; i += 16) {
            var olda = a;
            var oldb = b;
            var oldc = c;
            var oldd = d;
            a = this.md5_ff(a, b, c, d, x[i + 0], 7, -680876936);
            d = this.md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
            c = this.md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
            b = this.md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
            a = this.md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
            d = this.md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
            c = this.md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
            b = this.md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
            a = this.md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
            d = this.md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
            c = this.md5_ff(c, d, a, b, x[i + 10], 17, -42063);
            b = this.md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
            a = this.md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
            d = this.md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
            c = this.md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
            b = this.md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
            a = this.md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
            d = this.md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
            c = this.md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
            b = this.md5_gg(b, c, d, a, x[i + 0], 20, -373897302);
            a = this.md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
            d = this.md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
            c = this.md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
            b = this.md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
            a = this.md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
            d = this.md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
            c = this.md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
            b = this.md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
            a = this.md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
            d = this.md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
            c = this.md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
            b = this.md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
            a = this.md5_hh(a, b, c, d, x[i + 5], 4, -378558);
            d = this.md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
            c = this.md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
            b = this.md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
            a = this.md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
            d = this.md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
            c = this.md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
            b = this.md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
            a = this.md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
            d = this.md5_hh(d, a, b, c, x[i + 0], 11, -358537222);
            c = this.md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
            b = this.md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
            a = this.md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
            d = this.md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
            c = this.md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
            b = this.md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
            a = this.md5_ii(a, b, c, d, x[i + 0], 6, -198630844);
            d = this.md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
            c = this.md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
            b = this.md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
            a = this.md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
            d = this.md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
            c = this.md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
            b = this.md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
            a = this.md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
            d = this.md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
            c = this.md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
            b = this.md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
            a = this.md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
            d = this.md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
            c = this.md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
            b = this.md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
            a = this.safe_add(a, olda);
            b = this.safe_add(b, oldb);
            c = this.safe_add(c, oldc);
            d = this.safe_add(d, oldd);
        }
        return [a, b, c, d];
    };
    /*
     * These privates implement the four basic operations the algorithm uses.
     */
    md5.prototype.md5_cmn = function (q, a, b, x, s, t) {
        return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(a, q), this.safe_add(x, t)), s), b);
    };
    md5.prototype.md5_ff = function (a, b, c, d, x, s, t) {
        return this.md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
    };
    md5.prototype.md5_gg = function (a, b, c, d, x, s, t) {
        return this.md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
    };
    md5.prototype.md5_hh = function (a, b, c, d, x, s, t) {
        return this.md5_cmn(b ^ c ^ d, a, b, x, s, t);
    };
    md5.prototype.md5_ii = function (a, b, c, d, x, s, t) {
        return this.md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
    };
    /*
     * Add integers, wrapping at 2^32. This uses 16-bit operations internally
     * to work around bugs in some JS interpreters.
     */
    md5.prototype.safe_add = function (x, y) {
        var lsw = (x & 0xFFFF) + (y & 0xFFFF);
        var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
        return (msw << 16) | (lsw & 0xFFFF);
    };
    /*
     * Bitwise rotate a 32-bit number to the left.
     */
    md5.prototype.bit_rol = function (num, cnt) {
        return (num << cnt) | (num >>> (32 - cnt));
    };
    return md5;
}());
__reflect(md5.prototype, "md5");
/**
 *
 * @author
 *
 */
var ViewUtil = (function () {
    function ViewUtil() {
    }
    ViewUtil.setCenter = function (view) {
        /*
        view.x = (GlobalData.GameStage.stageWidth - view.width)/2;
        view.y = (GlobalData.GameStage.stageHeight - view.height)/2;*/
    };
    ViewUtil.getShape = function (width, height, color, alpha) {
        if (width === void 0) { width = 640; }
        if (height === void 0) { height = 960; }
        if (color === void 0) { color = 0x000000; }
        if (alpha === void 0) { alpha = 0.7; }
        var shp = new egret.Shape();
        //shp.graphics.beginFill(color,alpha);
        shp.graphics.drawRect(0, 0, width, height);
        //shp.graphics.endFill();
        shp.touchEnabled = false;
        return shp;
    };
    ViewUtil.isBoomGrid = function (width, height, color, alpha) {
        if (width === void 0) { width = 640; }
        if (height === void 0) { height = 960; }
        if (color === void 0) { color = 0x000000; }
        if (alpha === void 0) { alpha = 0.7; }
        var shp = new egret.Shape();
        shp.graphics.beginFill(color, alpha);
        shp.graphics.drawRect(0, 0, width, height);
        shp.graphics.endFill();
        shp.touchEnabled = false;
        return shp;
    };
    ViewUtil.getArtNum = function (art_src, src) {
        var con = new egret.Sprite();
        var i = 0;
        while (i < src.length) {
            var texture = RES.getRes(art_src + src.charAt(i));
            var bmp = new egret.Bitmap(texture);
            bmp.x = con.width + 1;
            bmp.y = -texture.textureHeight / 2;
            con.addChild(bmp);
        }
        return con;
    };
    /**检测碰撞*/
    ViewUtil.hitTest = function (obj1, obj2) {
        var rect1 = obj1.getBounds();
        var rect2 = obj2.getBounds();
        rect1.x = obj1.x;
        rect1.y = obj1.y;
        rect2.x = obj2.x;
        rect2.y = obj2.y;
        return rect1.intersects(rect2);
    };
    return ViewUtil;
}());
__reflect(ViewUtil.prototype, "ViewUtil");
/**成就系统管理类 */
var achievementMag = (function (_super) {
    __extends(achievementMag, _super);
    function achievementMag() {
        var _this = _super.call(this) || this;
        /**勋章类 */
        _this.medalVessel = [];
        _this.skinName = "resource/assets/skins/achievement.exml";
        _this.once(egret.Event.ADDED_TO_STAGE, _this.init, _this);
        DataProl.medal_main = _this;
        st_config.setScreenAuto(_this);
        return _this;
    }
    /**成就系统界面初始化 */
    achievementMag.prototype.init = function () {
        this.closeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.closeMain, this);
        this.loadMedal();
    };
    /**关闭界面 */
    achievementMag.prototype.closeMain = function () {
        this.parent.removeChild(this);
    };
    /**改变用户皮肤状态 */
    achievementMag.prototype.changeUserSkin = function (shopId, shopType, states) {
        this.screenMeg(shopId, shopType, states);
        var skinStates = [];
        for (var i = 0; i < GlobalData.userShopData.length; i++) {
            var skinChangeData1 = {
                accountId: DataProl.account,
                shopId: parseInt(GlobalData.userShopData[i].shopId),
                states: parseInt(GlobalData.userShopData[i].states)
            };
            skinStates.push(skinChangeData1);
        }
        //发送测试代码
        MiniNet.post(DataProl.shopaddr, '/setUserSkinStates', 'data=' + JSON.stringify(skinStates), this, this.setUserSkinCallBack);
    };
    /**筛选信息 */
    achievementMag.prototype.screenMeg = function (shopId, shopType, states) {
        switch (states) {
            case 0:
                for (var i = 0; i < GlobalData.userShopData.length; i++) {
                    if (parseInt(GlobalData.userShopData[i].shopId) == shopId) {
                        GlobalData.userShopData[i].states = "1";
                    }
                }
                break;
            case 1:
                for (var i = 0; i < GlobalData.userShopData.length; i++) {
                    if (parseInt(GlobalData.userShopData[i].shopId) == shopId) {
                        GlobalData.userShopData[i].states = "2";
                    }
                }
                break;
            case 2:
                for (var i = 0; i < GlobalData.userShopData.length; i++) {
                    if (parseInt(GlobalData.userShopData[i].shopId) == shopId) {
                        GlobalData.userShopData[i].states = "3";
                    }
                    if (GlobalData.userShopData[i].shopType == shopType && GlobalData.userShopData[i].states == "3" && parseInt(GlobalData.userShopData[i].shopId) != shopId) {
                        GlobalData.userShopData[i].states = "2";
                    }
                }
                break;
            case 3:
                for (var i = 0; i < GlobalData.userShopData.length; i++) {
                    if (parseInt(GlobalData.userShopData[i].shopId) == shopId) {
                        GlobalData.userShopData[i].states = "2";
                    }
                }
                break;
            default:
                break;
        }
    };
    /**更改皮肤状态成功回调 */
    achievementMag.prototype.setUserSkinCallBack = function (usrRecorData) {
        var shopsData = JSON.parse(usrRecorData.target.response);
        if (shopsData.shopData == true) {
            this.achievementVessel.removeChildren();
            this.loadMedal();
            if (DataProl.login_main_handle != null) {
                DataProl.login_main_handle.saveUserSkin(GlobalData.userShopData);
            }
            console.log("更改皮肤成功" + shopsData);
        }
        else {
            console.log("更改皮肤失败" + shopsData);
        }
    };
    /**加载勋章 */
    achievementMag.prototype.loadMedal = function () {
        var MedalNumber = 1;
        for (var i = 0; i < GlobalData.userShopData.length; i++) {
            var Medal = new achievementMedal(GlobalData.userShopData[i]);
            this.achievementVessel.addChild(Medal);
            this.medalVessel.push(Medal);
            MedalNumber++;
        }
        /**部署成就容器 */
        var tLayout = new eui.TileLayout();
        tLayout.paddingTop = 110;
        tLayout.paddingBottom = 10;
        tLayout.paddingLeft = 100;
        tLayout.paddingRight = 10;
        tLayout.columnAlign = eui.ColumnAlign.JUSTIFY_USING_GAP;
        tLayout.rowAlign = eui.RowAlign.JUSTIFY_USING_GAP;
        tLayout.horizontalGap = 70;
        tLayout.verticalGap = 80;
        this.achievementVessel.layout = tLayout;
    };
    return achievementMag;
}(eui.Component));
__reflect(achievementMag.prototype, "achievementMag");
/**成就勋章类 */
var achievementMedal = (function (_super) {
    __extends(achievementMedal, _super);
    function achievementMedal(data) {
        var _this = _super.call(this) || this;
        /**点击商品动作 */
        _this.GoodsAction = ["chuandai", "xiexia"];
        _this.init(data);
        return _this;
    }
    /**勋章初始化 */
    achievementMedal.prototype.init = function (data) {
        this.shopId = parseInt(data.shopId);
        this.states = parseInt(data.states);
        this.shopType = parseInt(data.shopType);
        this.medalToShopName = data.shopResName;
        var goodNameJson = RES.getRes("medal_json");
        var shopData = this.getGoodData(goodNameJson);
        this.shopName = shopData.shopName;
        this.noGetMedalName = shopData.medalResName;
        this.introduce = shopData.introduce;
        this.schedule = shopData.number;
        this.medalName = shopData.medalName;
        this.getMedalName = "medal_box";
        this.medalLayer = new eui.Component();
        this.skinLayer = new eui.Component();
        this.backgroundLayer = new eui.Component();
        this.addChild(this.backgroundLayer);
        var medal_beiJing = this.loadImg("bantouming", 0, 0, 160, 200);
        //medal_beiJing.alpha=0;
        this.backgroundLayer.addChild(medal_beiJing);
        this.addChild(this.medalLayer);
        this.addChild(this.skinLayer);
        this.goodShow();
    };
    /**物品显示 */
    achievementMedal.prototype.goodShow = function () {
        switch (this.states) {
            case 0:
                this.noGetMedalShow();
                break;
            case 1:
                this.getMedalShow();
                break;
            case 2:
            case 3:
                this.shopShow();
                break;
            default:
                break;
        }
    };
    /**获取商品数据 */
    achievementMedal.prototype.getGoodData = function (goodData) {
        for (var i = 0; i < goodData.length; i++) {
            if (goodData[i].shopId == this.shopId) {
                return goodData[i];
            }
        }
    };
    /**加载图片 */
    achievementMedal.prototype.loadImg = function (resName, x, y, width, height) {
        var Image = new eui.Image();
        Image.texture = RES.getRes(resName);
        Image.width = width;
        Image.height = height;
        Image.x = x;
        Image.y = y;
        Image.anchorOffsetX = Image.width / 2;
        Image.anchorOffsetY = Image.height / 2;
        return Image;
    };
    /**加载文字 */
    achievementMedal.prototype.loadLabel = function (content, _x, _y, width, heigth, rotation, size) {
        var Label = new eui.Label(content);
        Label.x = _x;
        Label.y = _y;
        Label.width = width;
        Label.height = heigth;
        Label.rotation = rotation;
        Label.size = size;
        Label.anchorOffsetX = Label.width / 2;
        Label.anchorOffsetY = Label.height / 2;
        Label.textAlign = egret.HorizontalAlign.CENTER;
        Label.verticalAlign = egret.VerticalAlign.MIDDLE;
        Label.fontFamily = "Microsoft YaHei";
        return Label;
    };
    /**重置勋章层/皮肤层 */
    achievementMedal.prototype.restAllLayer = function () {
        if (this.medalLayer.numChildren > 0) {
            this.medalLayer.removeChildren();
        }
        if (this.skinLayer.numChildren > 0) {
            this.skinLayer.removeChildren();
        }
    };
    /**没有获取到勋章状态 */
    achievementMedal.prototype.noGetMedalShow = function () {
        this.restAllLayer();
        var medal_hui = this.loadImg(this.noGetMedalName, 0, -5, 104, 118);
        this.medalLayer.addChild(medal_hui);
        this.achievementsProgress();
    };
    /**加载成就进度 */
    achievementMedal.prototype.achievementsProgress = function () {
        /**成就进度 */
        var min = 0;
        /**成就上线 */
        var max = 1;
        if (this.schedule >= 0 && this.schedule < 5) {
            switch (this.schedule) {
                case 0:
                    min = parseInt(GlobalData.usrRecorData.KillNumber);
                    max = parseInt(GlobalData.attainmentTargets.KillNumber);
                    break;
                case 1:
                    min = parseInt(GlobalData.usrRecorData.LineLength);
                    max = parseInt(GlobalData.attainmentTargets.LineLength);
                    break;
                case 2:
                    min = parseInt(GlobalData.usrRecorData.InvoteFriends);
                    max = parseInt(GlobalData.attainmentTargets.InvoteFriends);
                    break;
                case 3:
                    min = parseInt(GlobalData.usrRecorData.Weight);
                    max = parseInt(GlobalData.attainmentTargets.Weight);
                    break;
                case 4:
                    min = parseInt(GlobalData.usrRecorData.VipNumbers);
                    max = parseInt(GlobalData.attainmentTargets.VipNumbers);
                    break;
                default:
                    break;
            }
        }
        /**进度条 */
        var jinDu = this.loadImg("medal_tiao", -59, 80, min / max * 113, 6);
        jinDu.anchorOffsetX = 0;
        jinDu.anchorOffsetY = 0;
        /**进度条背景 */
        var di = this.loadImg("medal_di", -61, 79, 115, 8);
        di.anchorOffsetX = 0;
        di.anchorOffsetY = 0;
        this.medalLayer.addChild(di);
        this.medalLayer.addChild(jinDu);
        /**进度显示 */
        var jinDuShow = this.loadLabel(min + "/" + max, 0, 91, 100, 10, 0, 10);
        this.medalLayer.addChild(jinDuShow);
        /**达成信息 */
        var AWord = this.loadLabel(this.introduce, 0, 69, 156, 12, 0, 12);
        this.medalLayer.addChild(AWord);
        /**勋章名字 */
        var medalName = this.loadLabel(this.medalName, 0, -83, (this.medalName.length + 2) * 24, 24, 0, 24);
        medalName.bold = true; //设置是否加粗
        medalName.italic = true; //设置是否斜体
        //设置描边属性
        medalName.strokeColor = 0x000000;
        medalName.stroke = 1;
        this.medalLayer.addChild(medalName);
    };
    /**获取到勋章但是没有点击领取 */
    achievementMedal.prototype.getMedalShow = function () {
        var _this = this;
        this.restAllLayer();
        var medal = this.loadImg(this.getMedalName, 0, 0, 90, 90);
        this.medalLayer.addChild(medal);
        medal.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
            DataProl.medal_main.changeUserSkin(_this.shopId, _this.shopType, _this.states);
        }, this);
    };
    /**获取到成就皮肤显示 */
    achievementMedal.prototype.shopShow = function () {
        var _this = this;
        this.restAllLayer();
        //-------------------------------------加载商品饰品框
        var goodFrame = this.loadImg("shangpinkuang_1", 0, -10, 92, 92);
        this.skinLayer.addChild(goodFrame);
        //-------------------------------------加载商品图片
        if (this.shopType == 0) {
            var goodImg = this.loadImg(this.medalToShopName, 0, -10, 90, 40);
            this.skinLayer.addChild(goodImg);
        }
        else {
            var goodImg = this.loadImg(this.medalToShopName, 0, -10, 70, 90);
            this.skinLayer.addChild(goodImg);
        }
        //-------------------------------------加载商品文字
        var goodLab = this.loadLabel(this.shopName, 0, -83, (this.shopName.length + 2) * 24, 24, 0, 24);
        goodLab.bold = true; //设置是否加粗
        goodLab.italic = true; //设置是否斜体
        //设置描边属性
        goodLab.strokeColor = 0x000000;
        goodLab.stroke = 1;
        this.skinLayer.addChild(goodLab);
        //-------------------------------------加载商品点击状态
        var goodAction = this.states == 2 ? 0 : 1;
        var goodAct = this.loadImg(this.GoodsAction[goodAction], 0, 70, 120, 58);
        goodAct.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
            SoundManager.getInstance().playEffectSound("click_mp3");
            egret.Tween.get(goodAct).to({ scaleX: 0.7, scaleY: 0.7 }, 100).to({ scaleX: 1, scaleY: 1 }, 100);
            DataProl.medal_main.changeUserSkin(_this.shopId, _this.shopType, _this.states);
        }, this);
        this.skinLayer.addChild(goodAct);
    };
    return achievementMedal;
}(eui.Component));
__reflect(achievementMedal.prototype, "achievementMedal");
/**龙骨动画类 */
var meterAanimation = (function (_super) {
    __extends(meterAanimation, _super);
    /**构造 */
    function meterAanimation() {
        var _this = _super.call(this) || this;
        /**动画资源名字 */
        _this.dragonResString = ["frogDragonLv1", "frogDragonLv2", "frogDragonLv3", "frogDragonLv4"];
        /**动画骨架名字 */
        _this.dragonSkeletonString = ["LV1", "LV2", "LV3", "LV4"];
        /**动画动作名字 */
        _this.dragonActionSting = ["move", "move", "move", "move"];
        /**骨架资源 */
        _this.dragonSkeletonData = [];
        /**图片配置文件资源 */
        _this.dragonTextureData = [];
        /**图片资源 */
        _this.dragonTexture = [];
        _this.factory = new dragonBones.EgretFactory();
        _this.CreateRes();
        return _this;
    }
    /**获取单例对象 */
    meterAanimation.getInstance = function () {
        if (this.instance == null) {
            this.instance = new meterAanimation();
        }
        return this.instance;
    };
    /**创建资源 */
    meterAanimation.prototype.CreateRes = function () {
        if (this.dragonSkeletonData.length > 0) {
            console.log("请勿重复加载龙骨资源");
            return;
        }
        for (var i = 0; i < this.dragonResString.length; i++) {
            this.loadDragonRes(this.dragonResString[i]);
        }
        console.log("龙骨资源加载完毕");
    };
    /**加载龙骨动画资源
    * @param ResName 资源名
    */
    meterAanimation.prototype.loadDragonRes = function (ResName) {
        /**骨架资源 */
        var skeletonData = RES.getRes(ResName + "_ske_json");
        if (skeletonData == null) {
            console.log("骨架资源加载失败：" + ResName);
            return;
        }
        /**贴图资源配置文件 */
        var textureData = RES.getRes(ResName + "_tex_json");
        if (textureData == null) {
            console.log("贴图配置文件加载失败：" + ResName);
            return;
        }
        /**贴图图集资源 */
        var texture = RES.getRes(ResName + "_tex_png");
        if (texture == null) {
            console.log("贴图资源加载失败：" + ResName);
            return;
        }
        this.dragonSkeletonData.push(skeletonData);
        this.dragonTextureData.push(textureData);
        this.dragonTexture.push(texture);
    };
    /**获取龙骨显示对象
     * @param rank 等级
     */
    meterAanimation.prototype.GetDragonAnimation = function (rank) {
        rank--;
        /**骨架资源 */
        var skeletonData = this.dragonSkeletonData[rank];
        /**贴图配置文件 */
        var textureData = this.dragonTextureData[rank];
        /**贴图文件 */
        var texture = this.dragonTexture[rank];
        /**临时工厂变量 */
        var factory = this.factory;
        var DragonBonesData = factory.getAllDragonBonesData();
        if (this.dragonResString[rank] in DragonBonesData) {
        }
        else {
            //绑定骨架信息
            factory.addDragonBonesData(factory.parseDragonBonesData(skeletonData));
            //绑定贴图
            factory.addTextureAtlasData(factory.parseTextureAtlasData(textureData, texture));
        }
        /**动画对象 */
        var armature = factory.buildArmature(this.dragonSkeletonString[rank]);
        armature.animation.timeScale = 2.5;
        /**动画显示对象 */
        var armatureDisplay = armature.getDisplay();
        armatureDisplay.x = 0;
        armatureDisplay.y = 0;
        armatureDisplay.scaleX = armatureDisplay.scaleY = 0.3;
        armature.animation.play(this.dragonActionSting[rank]);
        //添加到时钟
        dragonBones.WorldClock.clock.add(armature);
        return armatureDisplay;
    };
    /**开启时钟 */
    meterAanimation.prototype.openClock = function () {
        this.addEventListener(egret.Event.ENTER_FRAME, function () {
            dragonBones.WorldClock.clock.advanceTime(0.01);
        }, this);
    };
    return meterAanimation;
}(eui.Component));
__reflect(meterAanimation.prototype, "meterAanimation");
var soundMgr = (function () {
    function soundMgr() {
    }
    /**
     * 播放声音
     * path 声音路径
     * loopCount 循环次数 <无限循环
     */
    soundMgr.prototype.playerSound = function (path, loopCount) {
        var sound = this._sound = new egret.Sound();
        ;
        //sound 加载完成监听
        sound.addEventListener(egret.Event.COMPLETE, function (e) {
            //sound 播放会返回一个 SoundChannel 对象，暂停、音量等操作请控制此对象
            this._channel = this._sound.play(0, loopCount);
        }, this);
        sound.load(path);
    };
    /**关闭声音 */
    soundMgr.prototype.closeSound = function () {
        if (this._channel != null) {
            this._channel.stop();
            this._channel = null;
        }
    };
    return soundMgr;
}());
__reflect(soundMgr.prototype, "soundMgr");
var control;
(function (control) {
    /**
     * @author vinson
     * 创建时间：2017-12-18 上午9:36:42
     * 2D摄像机(适用于物理引擎)
     * 此类与BasicCamera,LayerCamera最大不同是目标是在外部控制移动
     */
    var Camera2D = (function () {
        function Camera2D(screen, cameraRect) {
            /**速度（目标移动的速度）*/
            this.vx = 0;
            this.vy = 0;
            /**上一次的目标坐标 */
            this.prevX = 0;
            this.prevY = 0;
            /**边境值比例（相对摄像机的）*/
            this.leftTop = 0.5;
            this.rightBottom = 0.5;
            this.layers = new Array;
            /**摄像机本地临时变量 */
            this.cameraLocalTem = new egret.Point();
            /**目标锚点
             * 锚点默认是左上，如果居中设置为（0.5,0.5）*/
            this.anchorPoint = new egret.Point(0.5, 0.5);
            /**时间间隔 */
            this.timeOnEnterFrame = 0;
            // this.target=target;
            this.screen = screen;
            this.cameraRect = cameraRect;
            this.setBoundary(this.leftTop, this.rightBottom);
            this.screenWidth = screen.width;
            this.screenHeight = screen.height;
        }
        /**定义边界 ，即定义个相对运动的视窗，
         * 当操作对象没有达到边界的时候，即视窗内时是对象移动。
         * 当超过这个视窗的时候，就场景移动*/
        Camera2D.prototype.setBoundary = function (leftTop, rightBottom) {
            this.leftTop = leftTop;
            this.rightBottom = rightBottom;
            this.leftBoundary = this.cameraRect.width * this.leftTop;
            this.topBoundary = this.cameraRect.height * this.leftTop;
            this.rightBoundary = this.cameraRect.width * this.rightBottom;
            this.bottomBoundary = this.cameraRect.height * this.rightBottom;
        };
        /**设置目标*/
        Camera2D.prototype.setTarget = function (target) {
            this.target = target;
            // this.prevX = this.target.x;
            // this.prevY = this.target.y;
            this.prevX = GlobalData.GameStage_width * DataProl.gameSceneScal / 2;
            this.prevY = GlobalData.GameStage_height * DataProl.gameSceneScal / 2;
        };
        /**摄像机移动
         * 场景updata调用
         */
        Camera2D.prototype.move = function () {
            if (this.target == null)
                return;
            // var now = egret.getTimer();
            // var time = this.timeOnEnterFrame;
            // var pass = now - time;
            // this.timeOnEnterFrame = egret.getTimer();
            /**临时位置x */
            var temporaryPointX;
            /**临时位置y */
            var temporaryPointY;
            this.vx = this.target.x - this.prevX;
            this.vy = this.target.y - this.prevY;
            this.prevX = this.target.x;
            this.prevY = this.target.y;
            if (this.vx == 0 && this.vy == 0) {
                return;
            }
            egret.Tween.removeTweens(this.screen);
            var local = this.target.parent.localToGlobal(this.target.x, this.target.y, this.cameraLocalTem);
            var targetW = this.target.width * this.anchorPoint.x;
            var targetH = this.target.height * this.anchorPoint.y;
            //-----x轴-----
            if (this.vx > 0) {
                //目标达到右边界
                if (local.x + targetW > this.rightBoundary) {
                    temporaryPointX = this.screen.x -= this.vx;
                }
                //场景已经移到右尽头
                if (temporaryPointX < this.cameraRect.width - this.screenWidth) {
                    temporaryPointX = this.cameraRect.width - this.screenWidth;
                }
                if (temporaryPointX != null) {
                    this.screen.x = temporaryPointX;
                }
            }
            else if (this.vx < 0) {
                //目标达到左边界
                if (local.x < this.leftBoundary) {
                    temporaryPointX = this.screen.x -= this.vx;
                }
                //场景已经移到左尽头
                if (temporaryPointX > this.cameraRect.x) {
                    temporaryPointX = this.cameraRect.x;
                }
                if (temporaryPointX != null) {
                    this.screen.x = temporaryPointX;
                }
            }
            //-----y轴-----
            if (this.vy > 0) {
                //目标达到上边界
                if (local.y + targetH > this.bottomBoundary) {
                    temporaryPointY = this.screen.y -= this.vy;
                }
                //场景已经移到上尽头
                if (temporaryPointY < this.cameraRect.height - this.screenHeight) {
                    temporaryPointY = this.cameraRect.height - this.screenHeight;
                }
                if (temporaryPointY != null) {
                    this.screen.y = temporaryPointY;
                }
            }
            else if (this.vy < 0) {
                //目标达到下边界
                if (local.y < this.topBoundary) {
                    temporaryPointY = this.screen.y -= this.vy;
                }
                //场景已经移到下尽头
                if (temporaryPointY > this.cameraRect.y) {
                    temporaryPointY = this.cameraRect.y;
                }
                if (temporaryPointY != null) {
                    this.screen.y = temporaryPointY;
                }
            }
        };
        return Camera2D;
    }());
    control.Camera2D = Camera2D;
    __reflect(Camera2D.prototype, "control.Camera2D");
})(control || (control = {}));
/**游戏结算界面 */
var GameOver = (function (_super) {
    __extends(GameOver, _super);
    function GameOver() {
        var _this = _super.call(this) || this;
        _this.roomid = -1;
        /**用户数据 */
        _this.userData = [];
        /**是否添加上页下页侦听 */
        _this.isUpDown = true;
        /**背景音乐 */
        _this.bgSound = new soundMgr();
        _this.skinName = "resource/assets/skins/gameOverSkin.exml";
        st_config.setScreenAuto(_this);
        _this.init();
        return _this;
    }
    GameOver.prototype.init = function () {
        this.gameAgain.touchEnabled = true;
        this.gameExit.touchEnabled = true;
        this.gameAgain.addEventListener(egret.TouchEvent.TOUCH_TAP, this.gameGoOn, this);
        this.gameExit.addEventListener(egret.TouchEvent.TOUCH_TAP, this.backToHall, this);
        this.fenxiang.addEventListener(egret.TouchEvent.TOUCH_TAP, this.dianfenxiang, this);
        this.reward.addEventListener(egret.TouchEvent.TOUCH_TAP, this.watchVideo, this);
    };
    GameOver.prototype.watchVideo = function () {
        wxtool.Instance.OpenAD("adunit-423aa89d6762dee9");
    };
    /**点击分享 */
    GameOver.prototype.dianfenxiang = function () {
        this.fenxiang.visible = false;
        SoundManager.getInstance().playEffectSound("click_mp3");
        console.log("点击分享");
        weixinManager.getInstance().clikShare();
    };
    /**本地服务器加钱 */
    GameOver.prototype.addmoney = function (ss) {
        if (DataProl.isVisitor == false) {
            var value = 'accountId=' + DataProl.account + '&addMoney=' + ss;
            MiniNet.post(DataProl.shopaddr, '/shop_share', value, this, this.addMoneyCallback);
        }
    };
    GameOver.prototype.addMoneyCallback = function (userMoneyData) {
        var userMoney = JSON.parse(userMoneyData.target.response);
        DataProl.userCurrentDressUp.userMoney = userMoney;
    };
    ;
    /**改变大小可见范围 */
    GameOver.prototype.changeVis = function (scal) {
        /**设置屏幕缩放比例 */
        //egret.Tween.get(this).to({ scaleX: scal, scaleY: scal }, 500);
        this.scaleX = this.scaleY = scal;
    };
    /**返回大厅 */
    GameOver.prototype.backToHall = function () {
        SoundManager.getInstance().playEffectSound("click_mp3");
        this.bgSound.closeSound();
        webNetworkMananger.getInstance().gameSceneRec.backToHall();
        // if (webNetworkMananger.isServerMove)
        // 	webNetworkMananger.getInstance().SendMeesage('backToHall', DataProl.account);
        console.log("玩家: " + DataProl.account + "  离开游戏..");
        this.visible = false;
    };
    /**继续游戏 */
    GameOver.prototype.gameGoOn = function () {
        SoundManager.getInstance().playEffectSound("click_mp3");
        webNetworkMananger.getInstance().gameSceneRec.isUserDied = false;
        this.visible = false;
        var useData = {
            "roomId": DataProl.roomid,
            "account": DataProl.account
        };
        if (webNetworkMananger.isServerMove) {
            var m_AwesomeMessage = new awesomepackage.AwesomeMessage();
            var m_c2sRespawn = new awesomepackage.c2sRespawn();
            m_c2sRespawn.account = DataProl.account;
            m_c2sRespawn.sign = DataProl.sign;
            m_c2sRespawn.roomId = DataProl.roomid;
            m_AwesomeMessage.meesageId = 1006;
            m_AwesomeMessage.data = awesomepackage.c2sRespawn.encode(m_c2sRespawn).finish();
            var buffer = awesomepackage.AwesomeMessage.encode(m_AwesomeMessage).finish();
            var byte2 = new egret.ByteArray(buffer);
            webNetworkMananger.getInstance().SendBitMeesage(byte2);
            var user = webNetworkMananger.getInstance().gameSceneRec.m_createAllFrogs.findFrogById(DataProl.account);
            user.reset();
            setTimeout(function () {
                user.OnresetShadowFogPoint(user); ///**重置影子青蛙的位置 */
            }, 300);
        }
        else {
            webNetworkMananger.getInstance().gameSceneRec.gameAgain();
        }
        //this.bgSound.closeSound();
        //this.bgSound.playerSound("resource/assets/sound/onclick.WAV", 1);
    };
    /**更改用户成就进度 */
    GameOver.prototype.changeUserRecord = function (userdata) {
        /**线长 */
        var lineLength = 0;
        /**VIP局数 */
        var vipNumber = 0;
        /**体重比例 */
        var weight = webNetworkMananger.getInstance().gameSceneRec.m_createAllFrogs.findFrogById(DataProl.account).scaleX;
        for (var i = 0; i < userdata.length; i++) {
            if (userdata[i].name == gameGlobal.global.playerName) {
                //获取线长
                lineLength = userdata[i].tongueLength;
                //获取是否是vip
                if (i == 0) {
                    vipNumber++;
                }
                break;
            }
        }
        GlobalData.usrRecorData.KillNumber += DataProl.struckSeveral;
        GlobalData.usrRecorData.LineLength += lineLength;
        GlobalData.usrRecorData.InvoteFriends += DataProl.invoteFriends;
        GlobalData.usrRecorData.Weight += weight;
        GlobalData.usrRecorData.VipNumbers += vipNumber;
        var data = {
            KillNumber: GlobalData.usrRecorData.KillNumber,
            LineLength: GlobalData.usrRecorData.LineLength,
            InvoteFriends: GlobalData.usrRecorData.InvoteFriends,
            Weight: GlobalData.usrRecorData.Weight,
            VipNumbers: GlobalData.usrRecorData.VipNumbers,
            accountId: DataProl.account
        };
        //发送测试代码
        MiniNet.post(DataProl.shopaddr, '/changeUserRecord', 'data=' + JSON.stringify(data), this, this.changeUserRecordCallBack);
    };
    /**更改用户进度回调 */
    GameOver.prototype.changeUserRecordCallBack = function (usrRecorData) {
        var RecoData = JSON.parse(usrRecorData.target.response);
        if (RecoData.shopData) {
            this.getRecorfToMedal(GlobalData.usrRecorData);
            this.restAchievementData();
        }
        console.log("更改记录成功记录数" + RecoData);
    };
    /**初始化成就数据 */
    GameOver.prototype.restAchievementData = function () {
        DataProl.isEvenLine = false;
        DataProl.connectionNumber = [];
        DataProl.struckSeveral = 0;
        DataProl.invoteFriends = 0;
    };
    /**根据进度获取相应的勋章 */
    GameOver.prototype.getRecorfToMedal = function (RecoData) {
        var goodsId = 0;
        //1001黑框眼镜（百人斩）
        if (parseInt(RecoData.KillNumber) >= GlobalData.attainmentTargets.KillNumber) {
            if (!this.checkIsHaveMedal(1001)) {
                goodsId++;
            }
        }
        if (DataProl.connectionNumber.length > 0) {
            //1003心形眼镜（一局跟玩家没断过线）
            if (DataProl.connectionNumber.length == 1) {
                if (!this.checkIsHaveMedal(1003)) {
                    goodsId++;
                }
            }
            //1002绿色眼镜（和所有玩家连过线）
            if (DataProl.connectionNumber.length >= 9) {
                if (!this.checkIsHaveMedal(1002)) {
                    goodsId++;
                }
            }
        }
        //1004闪光眼镜（没有和任何玩家连线）
        if (!DataProl.isEvenLine) {
            if (!this.checkIsHaveMedal(1004)) {
                goodsId++;
            }
        }
        //1005花花眼镜（累计线长10000米）
        if (parseInt(RecoData.LineLength) >= GlobalData.attainmentTargets.LineLength) {
            if (!this.checkIsHaveMedal(1005)) {
                goodsId++;
            }
        }
        //2001心形拖尾（100局第一）
        if (parseInt(RecoData.VipNumbers) >= GlobalData.attainmentTargets.VipNumbers) {
            if (!this.checkIsHaveMedal(2001)) {
                goodsId++;
            }
        }
        //2002星星拖尾（最大体重超过1000）
        if (parseInt(RecoData.Weight) >= GlobalData.attainmentTargets.Weight) {
            if (!this.checkIsHaveMedal(2002)) {
                goodsId++;
            }
        }
        //2003桃花拖尾（邀请好友进行游戏10次）
        if (parseInt(RecoData.InvoteFriends) >= GlobalData.attainmentTargets.InvoteFriends) {
            if (!this.checkIsHaveMedal(2003)) {
                goodsId++;
            }
        }
        if (goodsId > 0) {
            this.changeUserSkin();
        }
    };
    /**改变用户皮肤状态 */
    GameOver.prototype.changeUserSkin = function () {
        var skinStates = [];
        for (var i = 0; i < GlobalData.userShopData.length; i++) {
            var skinChangeData1 = {
                accountId: DataProl.account,
                shopId: parseInt(GlobalData.userShopData[i].shopId),
                states: parseInt(GlobalData.userShopData[i].states)
            };
            skinStates.push(skinChangeData1);
        }
        //发送测试代码
        MiniNet.post(DataProl.shopaddr, '/setUserSkinStates', 'data=' + JSON.stringify(skinStates), this, this.setUserSkinCallBack);
    };
    /**更改皮肤状态成功回调 */
    GameOver.prototype.setUserSkinCallBack = function (usrRecorData) {
        var shopsData = JSON.parse(usrRecorData.target.response);
        if (shopsData.shopData == true) {
            console.log("更改皮肤成功" + shopsData);
        }
        else {
            console.log("更改皮肤失败" + shopsData);
        }
    };
    /**判断是否拥有此勋章 */
    GameOver.prototype.checkIsHaveMedal = function (goodId) {
        for (var i = 0; i < GlobalData.userShopData.length; i++) {
            if (parseInt(GlobalData.userShopData[i].shopId) == goodId) {
                if (parseInt(GlobalData.userShopData[i].states) > 0) {
                    return true;
                }
                else {
                    GlobalData.userShopData[i].states = "1";
                    return false;
                }
            }
        }
        return true;
    };
    /**显示战绩 */
    GameOver.prototype.showTops = function (userdata) {
        var _this = this;
        if (webNetworkMananger.isServerMove) {
            this.changeUserRecord(userdata);
        }
        this.currentPage = 1;
        webNetworkMananger.getInstance().gameSceneRec.isUserDied = true;
        if (userdata != null) {
            if (userdata.length > 0) {
                userdata.sort(function (a, b) { return b.grade - a.grade; });
                this.userData = [];
                //算两队总击杀数
                if (DataProl.tuanduizhan) {
                    /**绿队总击杀 */
                    var lvzhanji = 0;
                    /**黄队总击杀 */
                    var huangzhanji = 0;
                    for (var i = 0; i < userdata.length; i++) {
                        if (userdata[i].troops == 0) {
                            lvzhanji += userdata[i].killNumber;
                        }
                        else {
                            huangzhanji += userdata[i].killNumber;
                        }
                    }
                }
                //青蛙数据处理
                for (var i = 0; i < userdata.length; i++) {
                    //跟历史最高长度比较存战绩
                    if (userdata[i].userId == DataProl.account) {
                        if (DataProl.isVisitor == false) {
                            if (userdata[i].lineLength > DataProl.maxLong) {
                                DataProl.maxLong = userdata[i].lineLength;
                                console.log("存战绩:" + userdata[i].lineLength);
                                var value = 'userid=' + DataProl.account + '&maxLong=' + DataProl.maxLong + '&name=' + gameGlobal.global.playerName;
                                MiniNet.post(DataProl.loginaddr, '/wechat/update', value, this, this.sendMsg);
                            }
                        }
                    }
                    var data;
                    if (webNetworkMananger.isServerMove) {
                        data = {
                            name: userdata[i].name,
                            lineLength: userdata[i].tongueLength
                        };
                    }
                    else {
                        data = {
                            name: userdata[i].name,
                            grade: userdata[i].grade,
                            userId: userdata[i].userId,
                            troops: userdata[i].troops,
                            killNumber: userdata[i].killNumber
                        };
                    }
                    if (DataProl.tuanduizhan) {
                        if (data.troops == 0) {
                            //添加绿队队名
                            if (this.userData.length == 0) {
                                var mm = {
                                    name: "绿队",
                                    lineLength: lvzhanji,
                                    userId: 0,
                                    troops: 0
                                };
                                this.userData.push(mm);
                            }
                            //添加绿队青蛙
                            this.userData.push(data);
                        }
                    }
                    else {
                        this.userData.push(data); //不是团队战
                    }
                }
                if (DataProl.tuanduizhan) {
                    for (var i = 0; i < userdata.length; i++) {
                        var da = {
                            name: userdata[i].name,
                            lineLength: userdata[i].lineLength,
                            userId: userdata[i].userId,
                            troops: userdata[i].troops,
                            killNumber: userdata[i].killNumber
                        };
                        if (da.troops == 1) {
                            //添加黄队队名
                            if (this.userData.length == 6) {
                                var mm = {
                                    name: "黄队",
                                    lineLength: huangzhanji,
                                    userId: 0,
                                    troops: 1
                                };
                                this.userData.push(mm);
                            }
                            //添加黄队青蛙
                            this.userData.push(da);
                        }
                    }
                }
                this.displayRecord.removeChildren();
                this.displayPartOfTheRecord(this.userData, 1);
            }
        }
        if (this.isUpDown) {
            //上一页点击事件
            this.previousPage.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
                if (_this.currentPage <= 1) {
                    return;
                }
                else {
                    _this.displayRecord.removeChildren();
                    _this.displayPartOfTheRecord(_this.userData, _this.currentPage - 1);
                    _this.currentPage--;
                }
            }, this);
            //下一页点击事件
            this.nextPage.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
                if (_this.currentPage >= 2) {
                    return;
                }
                else {
                    _this.displayRecord.removeChildren();
                    //this.userData.sort(function (a, b) { return b.lineLength - a.lineLength; });
                    _this.displayPartOfTheRecord(_this.userData, _this.currentPage + 1);
                    _this.currentPage++;
                }
            }, this);
            this.isUpDown = false;
        }
    };
    /**显示部分战绩
     * startIndex endIndex 显示区间
     */
    GameOver.prototype.displayPartOfTheRecord = function (userdata, currentPage) {
        var startIndex = 0;
        var endIndex = 7;
        /**起始下标 */
        var prev;
        if (currentPage == 1) {
            prev = 0;
        }
        else {
            prev = 8;
        }
        DataProl.dei = 0; //一局内死亡次数清零
        for (var t = 0; t < userdata.length; t++) {
            if (t < startIndex || t > endIndex)
                continue;
            var point = { x: 25, y: 25 + t * 50 };
            this.displayOnePlayerRecord(userdata[prev + t], point);
            //console.log(userdata[t].userId+"玩家ID"+DataProl.account);
            if (prev + t > userdata.length - 1) {
                continue;
            }
        }
    };
    /**向开放数据域通信(发送战绩) */
    GameOver.prototype.sendMsg = function (n) {
        if (weixinManager.getInstance().getCode() != null) {
            var platform_1 = window.platform;
            platform_1.openDataContext.postMessage({
                score: DataProl.maxLong.toString()
            });
        }
        // let openDataContext = wx.getOpenDataContext();
        // 	openDataContext.postMessage({
        // 	score: n.toString()
        // });
    };
    /**显示一个玩家的战绩
     * data  数据
     * point 位置
    */
    GameOver.prototype.displayOnePlayerRecord = function (data, point) {
        if (data == null || data == undefined) {
            return;
        }
        if (DataProl.tuanduizhan) {
            var dui = new eui.Label();
            console.log("青蛙·线长" + data.lineLength + "青蛙名字" + data.name + "青蛙·颜色" + data.frogType);
            if (data.troops == 1) {
                dui.text = "匪徒";
            }
            else if (data.troops == 0) {
                dui.text = "警察";
            }
            dui.width = 200;
            dui.height = 30;
            dui.x = point.x - 100;
            dui.y = point.y;
            this.displayRecord.addChild(dui);
        }
        /**名字 */
        var labelRecord = new eui.Label();
        if (data.name.length > 10)
            data.name = data.name.substring(0, 10);
        labelRecord.text = data.name;
        labelRecord.width = 300;
        labelRecord.height = 30;
        labelRecord.x = point.x;
        labelRecord.y = point.y;
        labelRecord.fontFamily = 'Microsoft YaHei';
        this.displayRecord.addChild(labelRecord);
        /**战绩 */
        var labelScore = new eui.Label();
        labelScore.text = data.grade;
        labelScore.width = 100;
        labelScore.height = 30;
        labelScore.x = point.x + 380;
        labelScore.y = point.y;
        labelScore.fontFamily = 'Microsoft YaHei';
        this.displayRecord.addChild(labelScore);
        if (data.userId == DataProl.account) {
            labelRecord.textColor = 0xFFD700;
            labelScore.textColor = 0xFFD700;
            if (DataProl.tuanduizhan)
                dui.textColor = 0xFFD700;
        }
    };
    return GameOver;
}(eui.Component));
__reflect(GameOver.prototype, "GameOver");
/**
 * 玩家死亡
 */
var playerDied = (function (_super) {
    __extends(playerDied, _super);
    function playerDied() {
        var _this = _super.call(this) || this;
        /**5秒倒计时 */
        _this.updataCountTime = new egret.Timer(1000, -1);
        _this.TIMEBackToHall = 2;
        _this.skinName = "resource/assets/skins/playerDiedSkin.exml";
        st_config.setScreenAuto(_this);
        _this.init();
        return _this;
    }
    playerDied.prototype.init = function () {
        this.gameAgain.touchEnabled = true;
        this.visible = false;
        this.addEventToImage();
    };
    /**改变大小可见范围 */
    playerDied.prototype.changeVis = function (scal) {
        /**设置屏幕缩放比例 */
        //egret.Tween.get(this).to({ scaleX: scal, scaleY: scal }, 500);
        this.scaleX = this.scaleY = scal;
    };
    /**给图片添加点击事件 */
    playerDied.prototype.addEventToImage = function () {
        this.gameAgain.addEventListener(egret.TouchEvent.TOUCH_TAP, this.setGameAgainEvent, this);
    };
    /***设置继续游戏事件 */
    playerDied.prototype.setGameAgainEvent = function () {
        SoundManager.getInstance().sound_effect_switch = true;
        SoundManager.getInstance().playEffectSound("click_mp3");
        this.updataCountRest();
        var useData = {
            "roomId": DataProl.roomid,
            "account": DataProl.account,
        };
        // //11111
        // webNetworkMananger.getInstance().gameSceneRec.isUserDied = false;
        if (webNetworkMananger.isServerMove) {
            var m_AwesomeMessage = new awesomepackage.AwesomeMessage();
            var m_c2sRespawn = new awesomepackage.c2sRespawn();
            m_c2sRespawn.account = DataProl.account;
            m_c2sRespawn.sign = DataProl.sign;
            m_c2sRespawn.roomId = DataProl.roomid;
            m_AwesomeMessage.meesageId = 1006;
            m_AwesomeMessage.data = awesomepackage.c2sRespawn.encode(m_c2sRespawn).finish();
            var buffer = awesomepackage.AwesomeMessage.encode(m_AwesomeMessage).finish();
            var byte2 = new egret.ByteArray(buffer);
            webNetworkMananger.getInstance().SendBitMeesage(byte2);
        }
        else {
            webNetworkMananger.getInstance().gameSceneRec.isUserDied = false;
            AIServer.getInstance().respawnMessageManager(DataProl.account, DataProl.login_data.nickName);
        }
        this.visible = false;
    };
    /**设置返回大厅事件 */
    playerDied.prototype.setBackToHallEvent = function () {
        DataProl.dei = 0; //一局内死亡次数清零
        webNetworkMananger.getInstance().gameSceneRec.backToHall();
        if (webNetworkMananger.isServerMove) {
            var m_AwesomeMessage = new awesomepackage.AwesomeMessage();
            var m_c2sBackToHall = new awesomepackage.c2sBackToHall();
            m_c2sBackToHall.account = DataProl.account;
            m_c2sBackToHall.sign = DataProl.sign;
            m_AwesomeMessage.meesageId = 1005;
            m_AwesomeMessage.data = awesomepackage.c2sBackToHall.encode(m_c2sBackToHall).finish();
            var buffer = awesomepackage.AwesomeMessage.encode(m_AwesomeMessage).finish();
            var byte2 = new egret.ByteArray(buffer);
            webNetworkMananger.getInstance().SendBitMeesage(byte2);
        }
        //	webNetworkMananger.getInstance().SendMeesage('backToHall', DataProl.account);
        console.log("玩家: " + DataProl.account + "  离开游戏..");
        this.visible = false;
    };
    /**显示玩家死亡面板 */
    playerDied.prototype.disPlayerDiedPanl = function () {
        SoundManager.getInstance().playEffectSound("gameOver_mp3");
        SoundManager.getInstance().sound_effect_switch = false;
        DataProl.dei++;
        //console.log("死亡次数" + DataProl.dei);
        webNetworkMananger.getInstance().gameSceneRec.isUserDied = true;
        this.visible = true;
        this.setDisCountTime();
    };
    /**设置倒计时 */
    playerDied.prototype.setDisCountTime = function () {
        this.countDispos();
        this.updataCountTime.addEventListener(egret.TimerEvent.TIMER, this.countDispos, this);
        this.updataCountTime.start();
    };
    /**倒计时处理 */
    playerDied.prototype.countDispos = function () {
        this.countDownTime.text = this.TIMEBackToHall.toString();
        if (this.TIMEBackToHall < 0) {
            this.updataCountRest();
            this.setBackToHallEvent();
            return;
        }
        this.TIMEBackToHall--;
    };
    playerDied.prototype.updataCountRest = function () {
        this.updataCountTime.removeEventListener(egret.TimerEvent.TIMER, this.countDispos, this);
        this.updataCountTime.reset();
        this.TIMEBackToHall = 2;
    };
    playerDied.prototype.GameOverDis = function () {
        this.visible = false;
        this.updataCountRest();
    };
    return playerDied;
}(eui.Component));
__reflect(playerDied.prototype, "playerDied");
/**
 * 显示玩家信息
 */
var playerPanel = (function (_super) {
    __extends(playerPanel, _super);
    function playerPanel(superDisplay) {
        var _this = _super.call(this) || this;
        /**倒计时 */
        _this.countDownTime = 360;
        /**吐舌遮罩角度 */
        _this.shootAngle = 0;
        _this.checkServerHertBeat = new egret.Timer(1000, 0);
        /**背景音乐 */
        _this.bgSound = new soundMgr();
        _this.c = serverConfig.config;
        _this.teammateMarkUpdatePoint = new egret.Point();
        /**是否要变小  测试用 */
        _this.isSmall = true;
        _this.roomTimer = new egret.Timer(1000, -1);
        _this.skinName = "resource/assets/skins/playerCtrlSkin.exml";
        _this.width = GlobalData.GameStage_width;
        _this.height = GlobalData.GameStage_height;
        st_config.setScreenAuto(_this);
        _this.init();
        _this.once(egret.Event.ADDED_TO_STAGE, _this.function_keys_init, _this);
        _this.superLayer = superDisplay;
        return _this;
    }
    playerPanel.prototype.init = function () {
        this.resetUserTop();
        this.teammateMark.visible = false;
        this.frogTag.visible = false;
        this.ligature.visible = false;
        this.breakLine.visible = false;
        this.roomNumber.visible = false;
        if (webNetworkMananger.isServerMove) {
            this.xinHao.visible = true;
            this.showRoomId();
            this.roomNumber.visible = true;
        }
        SoundManager.getInstance().playBgSound(false, "1");
        SoundManager.getInstance().playBgSound(true, "main_mp3");
        SoundManager.getInstance().scene = 1;
        this.killMan.visible = false;
        this.killNum.visible = false;
        this.disCd.visible = false;
        this.addChild(this.disCd);
        //如果是团队模式打开5v5排行榜
        this.top_Users.visible = true;
        //this.function_keys_init();
        this.backTohallInit();
        if (DataProl.isXinShou) {
            this.skip.visible = true;
        }
        this.shootHaloSwitch = false;
    };
    /**更新 */
    playerPanel.prototype.update = function () {
        //新手引导 吐舌光圈
        if (DataProl.isXinShou) {
            if (this.shootHaloSwitch) {
                //第一次
                if (this.shootHaloTimer == null) {
                    this.shootHaloTimer = Date.now();
                    egret.Tween.get(this.ligature).to({ alpha: 0.3 }, 1000, egret.Ease.sineIn).to({ alpha: 1, }, 1000, egret.Ease.sineIn);
                    egret.Tween.get(this.breakLine).to({ alpha: 0.3 }, 1000, egret.Ease.sineIn).to({ alpha: 1, }, 1000, egret.Ease.sineIn);
                }
                else {
                    if (Date.now() - this.shootHaloTimer > 2000) {
                        this.shootHaloTimer = Date.now();
                        egret.Tween.get(this.ligature).to({ alpha: 0.3 }, 1000, egret.Ease.sineIn).to({ alpha: 1 }, 1000, egret.Ease.sineIn);
                        egret.Tween.get(this.breakLine).to({ alpha: 0.3 }, 1000, egret.Ease.sineIn).to({ alpha: 1, }, 1000, egret.Ease.sineIn);
                    }
                }
            }
            else {
                egret.Tween.removeTweens(this.ligature);
                egret.Tween.removeTweens(this.breakLine);
            }
        }
    };
    /**功能键初始化 */
    playerPanel.prototype.function_keys_init = function () {
        this.shootAngle = 0;
        this.coolDownMask = new egret.Shape();
        this.addChild(this.coolDownMask);
        this.coolDown.mask = this.coolDownMask;
        this.coolDown.visible = false;
        this.ligature.addEventListener(egret.TouchEvent.TOUCH_TAP, this.tongue, this);
        this.breakLine.addEventListener(egret.TouchEvent.TOUCH_TAP, this.offLine, this);
        this.skip.addEventListener(egret.TouchEvent.TOUCH_TAP, this.newbieSkip, this);
    };
    /**跳过 */
    playerPanel.prototype.newbieSkip = function () {
        if (DataProl.isXinShou) {
            if (this.superLayer.prop_messageTimes < 8) {
                this.superLayer.set_scene2();
            }
            else {
                this.superLayer.displayer_message(15, 500, 500);
            }
        }
    };
    /**初始化模式选择 */
    playerPanel.prototype.initializeModeSelection = function () {
        DataProl.isXinShou = false;
        DataProl.isSingleGame = false;
        DataProl.isDoubleRocker = false;
        DataProl.tuanduizhan = false;
        webNetworkMananger.isServerMove = false;
        DataProl.isCreateRockerPlayer = false;
        DataProl.isOpenRockerjudge = false;
        DataProl.loginType = 0;
        DataProl.friendId = -1;
    };
    /**吐舌 */
    playerPanel.prototype.tongue = function () {
        if (webNetworkMananger.isServerMove) {
            this.superLayer.playerLoll();
            //------------------------------------冷却值
            if (DataProl.isXinShou) {
                return;
            }
            egret.Tween.get(this, { onChange: this.show_cd, onChangeObj: this }).to({ shootAngle: 360 }, 3000).call(this.restLine);
            this.ligature.touchEnabled = false;
            egret.Tween.get(this.ligature).to({ scaleX: 1.1, scaleY: 1.1 }, 50).to({ scaleX: 1, scaleY: 1, alpha: 0.5 }, 50);
            //this.ligature.alpha = 0.5;
            this.coolDownMask.x = this.coolDown.x;
            this.coolDownMask.y = this.coolDown.y;
            this.coolDown.visible = true;
        }
        else {
            if (AIServer.getInstance().getUserStates(DataProl.account) == 0) {
                this.superLayer.playerLoll();
                //------------------------------------冷却值
                if (DataProl.isXinShou) {
                    return;
                }
                egret.Tween.get(this, { onChange: this.show_cd, onChangeObj: this }).to({ shootAngle: 360 }, 3000).call(this.restLine);
                this.ligature.touchEnabled = false;
                egret.Tween.get(this.ligature).to({ scaleX: 1.1, scaleY: 1.1 }, 50).to({ scaleX: 1, scaleY: 1, alpha: 0.5 }, 50);
                //this.ligature.alpha = 0.5;
                this.coolDownMask.x = this.coolDown.x;
                this.coolDownMask.y = this.coolDown.y;
                this.coolDown.visible = true;
            }
        }
    };
    /**CD显示 */
    playerPanel.prototype.show_cd = function () {
        var shape = this.coolDownMask;
        //	console.log("btn" + this.coolDown.x);
        var angle = this.shootAngle;
        shape.graphics.clear();
        shape.graphics.beginFill(0x00ffff, 1);
        shape.graphics.moveTo(0, 0);
        shape.graphics.lineTo(this.coolDown.width / 2, 0);
        shape.graphics.drawArc(0, 0, this.coolDown.width / 2, 0, angle * Math.PI / 180, true);
        shape.graphics.lineTo(0, 0);
        shape.graphics.endFill();
    };
    playerPanel.prototype.createBitmapByName = function (name) {
        var result = new egret.Bitmap();
        var texture = RES.getRes(name);
        result.texture = texture;
        return result;
    };
    /**隐藏新手引导的部分引导*/
    playerPanel.prototype.hideGuideUi = function () {
        this.beijing.visible = false;
        this.userTongueLength.visible = false;
        this.top_Users.visible = false; //不显示排行榜
        this.backToHall.visible = false;
    };
    /**重置吐舌 */
    playerPanel.prototype.restLine = function () {
        egret.Tween.get(this.ligature).to({ scaleX: 1.1, scaleY: 1.1 }, 50).to({ scaleX: 1, scaleY: 1, alpha: 1 }, 50);
        this.shootAngle = 0;
        this.coolDown.visible = false;
        this.ligature.touchEnabled = true;
    };
    /**吐舌按钮锁定 */
    playerPanel.prototype.lock_tongue = function () {
        this.shootHaloSwitch = false;
        this.ligature.touchEnabled = false;
        this.ligature.alpha = 0;
        this.ligature.visible = false;
        this.breakLine.touchEnabled = false;
        this.breakLine.alpha = 0;
        this.breakLine.visible = false;
        this.coolDownMask.visible = false;
    };
    /**吐舌按钮解锁 */
    playerPanel.prototype.unlock_tongue = function () {
        this.shootHaloSwitch = true;
        this.ligature.touchEnabled = true;
        this.ligature.visible = true;
        this.ligature.alpha = 0.3;
        this.breakLine.touchEnabled = true;
        this.breakLine.alpha = 0.3;
        this.breakLine.visible = true;
        this.coolDownMask.visible = true;
    };
    /**跳过按钮解锁 */
    playerPanel.prototype.unlock_skip = function () {
        this.skip.touchEnabled = true;
        this.skip.alpha = 1;
    };
    /**跳过按钮锁定 */
    playerPanel.prototype.lock_skip = function () {
        this.skip.touchEnabled = false;
        this.skip.alpha = 0;
    };
    /**断线 */
    playerPanel.prototype.offLine = function () {
        if (DataProl.isXinShou) {
            this.superLayer.displayer_message(13, 1100, 600);
        }
        egret.Tween.removeTweens(this);
        if (webNetworkMananger.isServerMove) {
            var m_AwesomeMessage = new awesomepackage.AwesomeMessage();
            var m_c2sDisconnect = new awesomepackage.c2sDisconnect();
            m_c2sDisconnect.account = DataProl.account;
            m_c2sDisconnect.roomId = DataProl.roomid;
            m_AwesomeMessage.meesageId = 1031;
            m_AwesomeMessage.data = awesomepackage.c2sDisconnect.encode(m_c2sDisconnect).finish();
            var buffer = awesomepackage.AwesomeMessage.encode(m_AwesomeMessage).finish();
            var byte2 = new egret.ByteArray(buffer);
            webNetworkMananger.getInstance().SendBitMeesage(byte2);
        }
        else {
            AIServer.getInstance().breakLine(DataProl.account);
            if (DataProl.isXinShou) {
                return;
            }
            this.ligature.touchEnabled = false;
            this.ligature.alpha = 0.5;
            this.shootAngle = 0;
            egret.Tween.get(this, { onChange: this.show_cd, onChangeObj: this }).to({ shootAngle: 360 }, 3000).call(this.restLine);
            this.coolDown.visible = true;
        }
    };
    /**显示房间号 */
    playerPanel.prototype.showRoomId = function () {
        if (DataProl.roomid != null && DataProl.roomid != undefined) {
            this.roomNumber.text = "房间号:" + DataProl.roomid;
        }
        else {
            this.roomNumber.text = "房间号:未知";
        }
    };
    /**队友指示箭头更新
     * @param wallNum 1-上墙 2-右墙 3-下墙 4-左墙
     */
    playerPanel.prototype.teammateMarkUpdate = function (teammateByGlobal, rotation, wallNum) {
        /**基于面板的本地坐标 */
        var teammateMarkBylocal = this.globalToLocal(teammateByGlobal.x, teammateByGlobal.y);
        this.teammateMark.x = teammateMarkBylocal.x;
        this.teammateMark.y = teammateMarkBylocal.y;
        //this.teammateMark.rotation = rotation;
        var frogTagPoint = this.teammateMark.localToGlobal(17.5, 22, this.teammateMarkUpdatePoint);
        var frogTagPoint_local = this.frogTag.parent.globalToLocal(frogTagPoint.x, frogTagPoint.y);
        this.frogTag.x = frogTagPoint_local.x;
        this.frogTag.y = frogTagPoint_local.y;
        switch (wallNum) {
            case 1:
                if (teammateByGlobal.x > this.stage.stageWidth / 2) {
                    this.teammateMark.scaleX = 1;
                    this.teammateMark.scaleY = 1;
                }
                else {
                    this.teammateMark.scaleX = -1;
                    this.teammateMark.scaleY = 1;
                }
                break;
            case 2:
                if (teammateByGlobal.y > this.stage.stageHeight / 2) {
                    this.teammateMark.scaleX = -1;
                    this.teammateMark.scaleY = 1;
                }
                else {
                    this.teammateMark.scaleX = -1;
                    this.teammateMark.scaleY = -1;
                }
                break;
            case 3:
                if (teammateByGlobal.x > this.stage.stageWidth / 2) {
                    this.teammateMark.scaleX = 1;
                    this.teammateMark.scaleY = -1;
                }
                else {
                    this.teammateMark.scaleX = -1;
                    this.teammateMark.scaleY = -1;
                }
                break;
            case 4:
                if (teammateByGlobal.y > this.stage.stageHeight / 2) {
                    this.teammateMark.scaleX = 1;
                    this.teammateMark.scaleY = 1;
                }
                else {
                    this.teammateMark.scaleX = 1;
                    this.teammateMark.scaleY = -1;
                }
                break;
        }
        this.teammateMark.visible = true;
        this.frogTag.visible = true;
    };
    /**重置单人排行榜 */
    playerPanel.prototype.resetUserTop = function () {
        this.otherUserName.text = null;
        this.otherUserGrade.text = null;
        this.myMsg.text = null;
        this.myMsg.textColor = 0x00FF00;
        this.myGrade.text = null;
        this.myGrade.textColor = 0x00FF00;
    };
    // }
    /**信号——帧数显示 */
    playerPanel.prototype.show_frame_number = function () {
        if (DataProl.frameNumber != null) {
            this.zhenshu.text = "逻辑帧数:" + DataProl.frameNumber;
            if (DataProl.frameNumber >= 7) {
                this.xinHao.source = "xinhao_3_png";
            }
            else if (DataProl.frameNumber >= 4) {
                this.xinHao.source = "xinhao_2_png";
            }
            else {
                this.xinHao.source = "xinhao_1_png";
            }
        }
        else {
            this.xinHao.source = "xinhao_1_png";
        }
    };
    /**显示CD */
    playerPanel.prototype.displayCD = function (tim) {
        var _this = this;
        this.disCd.text = tim.toString();
        if (tim >= 0)
            setTimeout(function () { _this.displayCD(tim - 1); }, 1000);
        if (tim < 0)
            this.disCd.visible = false;
        ;
    };
    /**开启房间计时器 */
    playerPanel.prototype.startRoomTimer = function () {
        this.roomTimer.reset();
        this.roomTimer.removeEventListener(egret.TimerEvent.TIMER, this.roomTimeLoop, this);
        this.countDownTime = DataProl.roomStartTime;
        var nowTime = (new Date()).valueOf();
        var timeLag = nowTime - this.countDownTime;
        if (webNetworkMananger.isServerMove) {
            timeLag = 0;
        }
        this.countDownTime = (DataProl.roomTime / 1000) - Math.floor(timeLag / 1000);
        this.displayCountDownInfo(this.countDownTime--);
        this.roomTimer.addEventListener(egret.TimerEvent.TIMER, this.roomTimeLoop, this);
        this.roomTimer.start();
        //	this.moveLoop.addEventListener(egret.TimerEvent.TIMER, this.updata, this);();
    };
    /**改变大小可见范围 */
    playerPanel.prototype.changeVis = function (scal) {
        /**设置屏幕缩放比例 */
        //egret.Tween.get(this).to({ scaleX: scal, scaleY: scal }, 500);
        this.scaleX = this.scaleY = scal;
    };
    playerPanel.prototype.roomTimeLoop = function () {
        if (this.superLayer.isUserDied)
            return;
        this.displayCountDownInfo(this.countDownTime--);
        if (this.countDownTime < 0) {
            if (!webNetworkMananger.isServerMove) {
                this.superLayer.playerDiedDis();
            }
            this.roomTimer.removeEventListener(egret.TimerEvent.TIMER, this.roomTimeLoop, this);
            this.roomTimer.reset();
        }
    };
    playerPanel.prototype.frogKillMan = function (num) {
        var _this = this;
        this.killMan.visible = true;
        this.killMan.alpha = 1;
        this.killMan.scaleX = this.killMan.scaleY = 1;
        egret.Tween.get(this.killMan).to({ scaleX: 1.5, scaleY: 1.5 }, 1000);
        egret.Tween.get(this.killMan).to({ alpha: 0 }, 1000).call(function () { _this.killMan.visible = false; });
        this.killNum.visible = true;
        this.killNum.text = num + "";
        this.killNum.stroke = 1;
        this.killNum.strokeColor = 0xffffff;
        this.killNum.alpha = 1;
        this.killNum.scaleX = this.killNum.scaleY = 1;
        egret.Tween.get(this.killNum).to({ scaleX: 1.5, scaleY: 1.5 }, 1000);
        egret.Tween.get(this.killNum).to({ alpha: 0 }, 1000).call(function () { _this.killNum.visible = false; });
    };
    playerPanel.prototype.backTohallInit = function () {
        var _this = this;
        this.backToHall.touchEnabled = true;
        this.backToHall.addEventListener(egret.TouchEvent.TOUCH_TAP, function () {
            if (webNetworkMananger.isServerMove) {
                var m_AwesomeMessage = new awesomepackage.AwesomeMessage();
                var m_c2sBackToHall = new awesomepackage.c2sBackToHall();
                m_c2sBackToHall.account = DataProl.account;
                m_c2sBackToHall.sign = DataProl.sign;
                m_AwesomeMessage.meesageId = 1005;
                m_AwesomeMessage.data = awesomepackage.c2sBackToHall.encode(m_c2sBackToHall).finish();
                var buffer = awesomepackage.AwesomeMessage.encode(m_AwesomeMessage).finish();
                var byte2 = new egret.ByteArray(buffer);
                webNetworkMananger.getInstance().SendBitMeesage(byte2);
                //		webNetworkMananger.getInstance().SendMeesage('backToHall', DataProl.account);
            }
            webNetworkMananger.getInstance().gameSceneRec.backToHall();
            DataProl.dei = 0; //一局内死亡次数清零
            _this.countDownTime = -1;
            _this.roomTimer.removeEventListener(egret.TimerEvent.TIMER, _this.roomTimeLoop, _this);
            _this.roomTimer.reset();
            SoundManager.getInstance().playEffectSound("click_mp3");
        }, this);
    };
    /**返回大厅 */
    playerPanel.prototype.back = function () {
        SoundManager.getInstance().playEffectSound("click_mp3");
        this.bgSound.closeSound();
        this.superLayer.backToHall();
        // if (webNetworkMananger.isServerMove)
        // 	webNetworkMananger.getInstance().SendMeesage('backToHall', DataProl.account);
        this.visible = false;
    };
    /**显示房间计时器 */
    playerPanel.prototype.displayCountDownInfo = function (time) {
        var shi = Math.floor(time / 3600) < 10 ? "0" + Math.floor(time / 3600) : Math.floor(time / 3600);
        var fen = Math.floor(time / 60) < 10 ? "0" + Math.floor(time / 60) : Math.floor(time / 60);
        var miao = Math.floor(time % 60) < 10 ? "0" + Math.floor(time % 60) : Math.floor(time % 60);
        this.gameCountDownTime.text = shi + ":" + fen + ":" + miao;
    };
    /**显示玩家舌头长度 */
    playerPanel.prototype.displayUserTongueLength = function (length) {
        this.userTongueLength.text = length;
    };
    /**显示玩家衣服颜色 */
    playerPanel.prototype.displayUserClothesUpdata = function (shu) {
        //this.clothes.texture = RES.getRes(name);
        //this.changeClothes.yifu(this.clothes, shu)
    };
    /**从所有玩家身上获取排行 */
    playerPanel.prototype.disposAllUser = function (data) {
        this.getUserTopMsg(data);
    };
    /**获取单人排行榜信息 */
    playerPanel.prototype.getUserTopMsg = function (data) {
        var userlist = data;
        var player_data = [];
        var me_data = null;
        if (userlist.length > 0) {
            userlist.sort(function (a, b) { return b.grade - a.grade; });
            for (var i = 0; i < userlist.length; i++) {
                player_data.push({
                    userId: userlist[i].userId,
                    name: userlist[i].name,
                    grade: userlist[i].grade,
                    speed: userlist[i].speed
                });
            }
        }
        else {
            return;
        }
        this.showUserTopMsg(player_data);
    };
    /**显示单人排行榜信息 */
    playerPanel.prototype.showUserTopMsg = function (playerData) {
        if (playerData.length == 0) {
            return;
        }
        this.resetUserTop();
        for (var i = 0; i < Math.min(6, playerData.length); i++) {
            var otherName = playerData[i].name.length > 7 ? playerData[i].name.substring(0, 7) : playerData[i].name;
            if (i == 0) {
                this.otherUserName.text = otherName;
                this.otherUserGrade.text = playerData[i].grade;
            }
            else {
                this.otherUserName.text += "\n" + otherName;
                this.otherUserGrade.text += "\n" + playerData[i].grade;
            }
        }
        for (var a = 0; a < playerData.length; a++) {
            if (playerData[a].userId == DataProl.account) {
                //显示自己的名字/分数/名次
                var myName = playerData[a].name.length > 7 ? playerData[a].name.substring(0, 7) : playerData[a].name;
                var rank = a + 1;
                this.myMsg.text = rank.toString() + "  " + myName;
                this.myMsg.textColor = 0x00FF00;
                this.myGrade.text = playerData[a].grade;
                this.myGrade.textColor = 0x00FF00;
            }
        }
    };
    return playerPanel;
}(eui.Component));
__reflect(playerPanel.prototype, "playerPanel");
var roleControl = (function (_super) {
    __extends(roleControl, _super);
    function roleControl() {
        var _this = _super.call(this) || this;
        /**触摸球 */
        _this.handle = new eui.Image();
        /**圈 */
        _this.circle = new eui.Image();
        /**圈坐标 */
        _this.circle_position = { "x": 150 * DataProl.gameSceneScal, "y": (GlobalData.GameStage_height * DataProl.gameSceneScal - 150) }; //圈中心点的位置
        /**触摸球坐标 */
        _this.handle_position = { "x": 150 * DataProl.gameSceneScal, "y": (GlobalData.GameStage_height * DataProl.gameSceneScal - 150) }; //小球中心店的位置
        _this.touchID = null; //触摸id
        _this.circle_radius = 0;
        _this.handle_radius = 0;
        _this.jiaodu = 0; //返回角度
        _this.pos = new Vector_2();
        //联网发送位置定时器
        _this.sendMsgTimer = new egret.Timer(1000 / 10, -1);
        /**触摸位置
         * 1-屏幕左半边
         * 2-屏幕右半边
         */
        _this.touchLocation = 1;
        return _this;
    }
    roleControl.prototype.yaoganInit = function (object) {
        this.container = object;
        this.handle.texture = RES.getRes("hand");
        this.addChild(this.handle);
        this.handle.anchorOffsetX = this.handle.width / 2;
        this.handle.anchorOffsetY = this.handle.width / 2;
        this.handle.x = this.handle_position.x;
        this.handle.y = this.handle_position.y;
        this.circle.texture = RES.getRes("handbg");
        this.addChild(this.circle);
        this.circle.anchorOffsetX = this.circle.width / 2;
        this.circle.anchorOffsetY = this.circle.width / 2;
        this.circle.x = this.circle_position.x;
        this.circle.y = this.circle_position.y;
        this.circle_radius = this.circle.width / 2;
        this.handle_radius = this.handle.width / 2;
        this.container.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.MoveHandle, this);
        this.container.addEventListener(egret.TouchEvent.TOUCH_END, this.recoverHandle, this);
        this.container.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.MoveHandle, this);
        this.gameMapss = webNetworkMananger.getInstance().gameSceneRec;
        //console.log("摇杆初始化完成");
        // this.timer.addEventListener(egret.TimerEvent.TIMER, this.sendPosition, this);
        // this.timer.start();
        //console.log("摇杆定时器初始化完成");
        if (webNetworkMananger.isServerMove) {
            this.sendMsgTimer.addEventListener(egret.TimerEvent.TIMER, this.webSendPosition, this);
            this.sendMsgTimer.start();
            //console.log("联网模式定时器初始化完成");
        }
    };
    /**改变大小可见范围 */
    roleControl.prototype.changeVis = function (scal) {
        this.circle_position = { "x": 150 * DataProl.gameSceneScal, "y": (GlobalData.GameStage_height * DataProl.gameSceneScal - 150) }; //圈中心点的位置
        this.handle_position = { "x": 150 * DataProl.gameSceneScal, "y": (GlobalData.GameStage_height * DataProl.gameSceneScal - 150) }; //小球中心店的位置
        this.handle.scaleX = this.handle.scaleY = scal;
        this.circle.scaleX = this.circle.scaleY = scal;
        // egret.Tween.get(this.handle).to({ scaleX: scal, scaleY: scal }, 500);
        // egret.Tween.get(this.circle).to({ scaleX: scal, scaleY: scal }, 500);
        // egret.Tween.get(this.handle).to({ x: this.handle_position.x, y: this.handle_position.y }, 500);
        // egret.Tween.get(this.circle).to({ x: this.circle_position.x, y: this.circle_position.y }, 500);
        this.handle.x = this.handle_position.x;
        this.handle.y = this.handle_position.y;
        this.circle.x = this.circle_position.x;
        this.circle.y = this.circle_position.y;
    };
    /**摇杆锁定 */
    roleControl.prototype.lockControl = function () {
        this.islock = true;
    };
    /**摇杆解锁 */
    roleControl.prototype.unlockControl = function () {
        this.islock = false;
    };
    /**摇杆移动 */
    roleControl.prototype.MoveHandle = function (evt) {
        if (this.islock) {
            return;
        }
        var distanceX = Math.abs(evt.stageX - this.circle_position.x);
        var distanceY = Math.abs(evt.stageY - this.circle_position.y);
        var distance = Math.sqrt(Math.pow(distanceX, 2) + Math.pow(distanceY, 2));
        if (this.touchLocation == 1) {
            if (evt.stageX < gameGlobal.global.screenWidth / 2) {
                this.touchID = evt.touchPointID;
                var rotation = this.calculateRotation(this.circle_position, { "x": evt.stageX, "y": evt.stageY });
                var hudu = rotation * Math.PI / 180;
                if (distance < this.circle_radius) {
                    this.handle.x = evt.stageX;
                    this.handle.y = evt.stageY;
                }
                else {
                    this.handle.x = this.circle_position.x + Math.sin(hudu) * (this.circle_radius);
                    this.handle.y = this.circle_position.y - Math.cos(hudu) * (this.circle_radius);
                }
                this.jiaodu = Math.floor(rotation);
            }
        }
        else if (this.touchLocation == 2) {
            if (evt.stageX > gameGlobal.global.screenWidth / 2) {
                this.touchID = evt.touchPointID;
                var rotation = this.calculateRotation(this.circle_position, { "x": evt.stageX, "y": evt.stageY });
                var hudu = rotation * Math.PI / 180;
                if (distance < this.circle_radius) {
                    this.handle.x = evt.stageX;
                    this.handle.y = evt.stageY;
                }
                else {
                    this.handle.x = this.circle_position.x + Math.sin(hudu) * (this.circle_radius);
                    this.handle.y = this.circle_position.y - Math.cos(hudu) * (this.circle_radius);
                }
                this.jiaodu = Math.floor(rotation);
            }
        }
    };
    roleControl.prototype.handleTween = function (x, y) {
        egret.Tween.removeTweens(this.handle);
    };
    //复原小球的位置
    roleControl.prototype.recoverHandle = function (evt) {
        if (evt.touchPointID == this.touchID) {
            this.handle.x = this.circle_position.x;
            this.handle.y = this.circle_position.y;
            this.touchID = null;
            this.pos.x = this.pos.y = 0;
        }
    };
    //复原小球的位置(新手引导)
    roleControl.prototype.recoverHandle2 = function () {
        this.handle.x = this.circle_position.x;
        this.handle.y = this.circle_position.y;
        this.touchID = null;
        this.pos.x = this.pos.y = 0;
    };
    //小球偏移（x，y）(新手引导)
    roleControl.prototype.recoverHandle3 = function (x, y) {
        this.handle.x = this.circle_position.x + x;
        this.handle.y = this.circle_position.y + y;
        this.touchID = null;
        this.pos.x = this.pos.y = 0;
    };
    //获得方向
    roleControl.prototype.getRotation = function () {
        return this.jiaodu;
    };
    //获得x方向单位时间移动的距离 y方向单位时间移动的距离
    roleControl.prototype.getPosition = function () {
        //只去一位小数去掉浮点数的传播
        // this.pos.x = Math.floor((this.handle.x - this.circle_position.x) * 10);
        // this.pos.y = Math.floor((this.handle.y - this.circle_position.y) * 10);
        this.pos.x = this.handle.x - this.circle_position.x;
        this.pos.y = this.handle.y - this.circle_position.y;
        return this.pos;
        //gameMap.vector2_Mouse=pos;
        //console.log("1获取的位置" + this.pos.x + ":" + this.pos.y);
    };
    //给外部发送方向的方法
    roleControl.prototype.sendPosition = function () {
        this.getPosition();
        if (webNetworkMananger.isServerMove) {
            // if (!this.gameMapss.isUserDied) {
            // 	this.gameMapss.senMessageForServerPosition(this.pos);
            // }
            return;
        }
        if (DataProl.isDoubleRocker) {
            this.gameMapss.senMessageForServerPosition(this.pos, this.touchLocation);
        }
        else {
            //	this.gameMapss.senMessageForServerPosition(this.pos);
        }
    };
    /**联网模式发送位置消息 */
    roleControl.prototype.webSendPosition = function () {
        if (!this.gameMapss.isUserDied) {
            this.gameMapss.senMessageForServerPosition(this.pos);
        }
    };
    //计算角度 起点到终点
    roleControl.prototype.calculateRotation = function (player_position, mouse_position) {
        var rotation = 0;
        var offestx = Math.abs(mouse_position.x - player_position.x);
        var offesty = Math.abs(mouse_position.y - player_position.y);
        var alpha = Math.atan(offestx / offesty);
        rotation = alpha * 180 / Math.PI;
        if (mouse_position.x - player_position.x > 0 && mouse_position.y - player_position.y > 0) {
            rotation = 180 - rotation;
        }
        else if (mouse_position.x - player_position.x > 0 && mouse_position.y - player_position.y < 0) {
            rotation = rotation;
        }
        else if (mouse_position.x - player_position.x < 0 && mouse_position.y - player_position.y < 0) {
            rotation = 360 - rotation;
        }
        else if (mouse_position.x - player_position.x < 0 && mouse_position.y - player_position.y > 0) {
            rotation = 180 + rotation;
        }
        //console.log(rotation);
        return rotation;
    };
    roleControl.prototype.clearYaogan = function () {
        // this.timer.removeEventListener(egret.TimerEvent.TIMER, this.sendPosition, this);
        // this.timer.reset();
        if (this.container != null) {
            this.container.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.MoveHandle, this);
            this.container.removeEventListener(egret.TouchEvent.TOUCH_END, this.recoverHandle, this);
            this.container.removeEventListener(egret.TouchEvent.TOUCH_MOVE, this.MoveHandle, this);
        }
        if (this.contains(this.handle) && this.contains(this.circle)) {
            this.removeChild(this.handle);
            this.removeChild(this.circle);
        }
    };
    return roleControl;
}(eui.Component));
__reflect(roleControl.prototype, "roleControl");
var Vector_2 = (function () {
    function Vector_2() {
        this.x = 0;
        this.y = 0;
    }
    Vector_2.normalize = function (horizontal, vertical) {
        var unit = new Vector_2();
        var size = Math.sqrt(Math.pow(horizontal, 2) + Math.pow(vertical, 2));
        unit.x = horizontal / size;
        unit.y = vertical / size;
        return unit;
    };
    return Vector_2;
}());
__reflect(Vector_2.prototype, "Vector_2");
// import * as im from "../ymVoice/ymMgr";
var multGame = (function (_super) {
    __extends(multGame, _super);
    function multGame() {
        var _this = _super.call(this) || this;
        /**四号道具 */
        _this.daotime = Date.now();
        _this.rr = 0;
        _this.background = new eui.Group();
        _this.brorder = new eui.Group();
        /**玩家类型 */
        _this.clothes_List = ["lv", "huang", "qing"];
        //保存玩家的位置
        _this.myControlPoint = {
            x: 0,
            y: 0
        };
        //用于手柄部分
        _this.handle = new eui.Image(); //小球
        _this.circle = new eui.Image(); //圈
        _this.circle_position = { "x": 100, "y": gameGlobal.global.screenHeight - 100 }; //圈中心点的位置
        _this.handle_position = { "x": 100, "y": gameGlobal.global.screenHeight - 100 }; //小球中心店的位置
        _this.touchID = null; //触摸id
        _this.circle_radius = 0;
        _this.handle_radius = 0;
        _this.jiaodu = 0; //返回角度
        /**背景音乐 */
        _this.bgSound = new soundMgr();
        /**相关数据 */
        _this.con = gameGlobal;
        _this.config = _this.con.global; //account
        /**玩家信息 */
        _this.player = {
            id: DataProl.account,
            x: _this.config.screenWidth / 2,
            y: _this.config.screenHeight / 2,
            type: Math.round(Math.random() * 2 + 0),
            screenWidth: _this.config.screenWidth,
            screenHeight: _this.config.screenHeight,
            target: { x: _this.config.screenWidth / 2, y: _this.config.screenHeight / 2 },
            name: gameGlobal.global.playerName,
            hue: null,
            massTotal: null,
            cells: null,
            xoffset: -0,
            yoffset: -0,
        };
        //显示玩家的青蛙
        _this.myUser = { targetx: 0, targety: 0, userSprit: null };
        /**装饰品 */
        _this.decoration_List = ["lowpoly", "food"];
        /**线层*/
        _this.tongueLayer = new egret.Sprite();
        /**道具层 */
        _this.propLayer = new egret.Sprite();
        /**UI层 */
        _this.UiLayer = new eui.Component();
        /**游戏结束*/
        _this.GameOver = new GameOver();
        /**玩家死亡 */
        _this.userDied = new playerDied();
        /**玩家控制面板 */
        _this.playerPanel = new playerPanel(_this);
        /**；存房间玩家/青蛙 动画的容器 */
        _this.gameFrog = new egret.DisplayObjectContainer();
        /**青蛙管理 */
        _this.m_createAllFrogs = new frogMgr(_this);
        /**房间里所有的线 */
        _this.roomAllTongue = new egret.Sprite();
        _this.tongueManager = new tongueMgr(_this.roomAllTongue, _this.m_createAllFrogs);
        /**用于存储玩家是否死亡 控制是否接受服务器消息 */
        _this.isUserDied = false;
        /**道具管理 */
        _this.m_propMg = new propMgr(_this.propLayer);
        _this.game_Loop_tmp_point = new egret.Point(0, 0);
        _this.skinName = "resource/assets/skins/gameMapSkin.exml";
        _this.init();
        _this.once(egret.Event.ADDED_TO_STAGE, _this.initialize, _this);
        _this.tmpPoint = egret.Point.create(0, 0);
        return _this;
    }
    /**初始化 */
    multGame.prototype.initialize = function () {
        this.yaoganInit();
        this.parent.addChild(this.UiLayer);
        this.UiLayer.addChild(this.playerPanel);
        this.UiLayer.addChild(this.userDied);
        this.UiLayer.addChild(this.GameOver);
        this.playerPanel.startRoomTimer();
        this.changeVisibility(DataProl.gameSceneScal);
    };
    multGame.prototype.init = function () {
        resManager.getInstance().loadRes();
        console.log("init");
        this.resetShadowForgStates();
        this.startYMVoice();
        this.playBGMusic();
        webNetworkMananger.getInstance().gameSceneRec = this;
        this.m_createAllFrogs.createAllNetFrogs();
        var shadowFrog = this.m_createAllFrogs.findFrogById(DataProl.shadowFrogId);
        if (shadowFrog != null) {
            shadowFrog.reset();
        }
        this.m_shadowFrog = this.m_createAllFrogs.getOneFrog();
        this.m_shadowFrog.born(DataProl.shadowFrogId, "影子", 0, 0, 1, 1, null);
        if (serverConfig.config.shadowFrog) {
            this.m_shadowFrog.visble = true;
        }
        else {
            this.m_shadowFrog.visble = false;
        }
        this.mapInit();
        this.setChildIndex(this.brorder, this.numChildren);
        this.cameraInit();
        this.creatMyFog();
        this.userDied.visible = false;
        this.GameOver.visible = false;
        this.BeginTimes();
        /**如果是好友模式，局数++ */
        if (DataProl.loginType != 0) {
            DataProl.invoteFriends++;
        }
        DataProl.allPropData = null;
    };
    /**改变游戏内可见范围大小
    * vis: 屏幕缩放比例
    */
    multGame.prototype.changeVisibility = function (vis) {
        egret.MainContext.instance.stage.setContentSize(gameGlobal.global.screenWidth * vis, gameGlobal.global.screenHeight * vis);
        //this.yaogan.changeVis(vis);
        //this.camera.changeVis(vis);
        this.playerPanel.changeVis(vis);
        this.GameOver.changeVis(vis);
        this.userDied.changeVis(vis);
    };
    /**
     * 接入游密语音
     */
    multGame.prototype.startYMVoice = function () {
        //实例化游密语音
        // let ym = new ymMgr();
        // this.addChild(ym);
        // ym.init();
    };
    /**
     * 播放背景音乐
     */
    multGame.prototype.playBGMusic = function () {
        this.bgSound.closeSound();
        this.bgSound.playerSound("resource/assets/sound/game.wav", 0);
    };
    /**
     * 摄像机初始化
     */
    multGame.prototype.cameraInit = function () {
        var cameraRect = new egret.Rectangle(0, 0, gameGlobal.global.screenWidth * DataProl.gameSceneScal, gameGlobal.global.screenHeight * DataProl.gameSceneScal);
        this.camera = new control.Camera2D(this, cameraRect);
        // this.camera.addLayer(this.playerPanel);
        // this.camera.addLayer(this.GameOver);
        // this.camera.addLayer(this.yaogan);
        // this.camera.addLayer(this.userDied);
        //this.addEventListener(egret.Event.ENTER_FRAME, this.onLoop, this);
    };
    multGame.prototype.onLoop = function (e) {
        //this.camera.move();
    };
    /**地图初始化 */
    multGame.prototype.mapInit = function () {
        //this.drawBackground();
        //this.drawHexagon();
        //this.creatMapLine();
        /*房间的线 */
        this.addChild(this.roomAllTongue);
        /**房间内的道具 */
        this.addChild(this.propLayer);
        /**房间内的青蛙 */
        this.addChild(this.gameFrog);
    };
    multGame.prototype.gameOverDis = function (data) {
        /**游戏结束关闭玩家死亡界面*/
        this.userDied.GameOverDis();
        this.GameOver.visible = true;
        this.GameOver.showTops(data);
    };
    /**显示服务器错误信息*/
    multGame.prototype.displayErrorMessage = function (data) {
        console.log(data);
        //this.playerPanel.displayErrorMessage(data);
    };
    /**游戏更新 */
    multGame.prototype.game_Loop = function () {
        this.yaogan.sendPosition();
        this.m_createAllFrogs.updateVeer();
        this.playerPanel.show_frame_number();
        //处理服务器道具信息
        if (DataProl.allPropData != null) {
            this.m_propMg.propsUpdata(DataProl.allPropData);
            //console.log(this.propLayer)
            //DataProl.allPropData = null;
        }
        this.visualChange();
        this.camera.move();
        this.check_can_breakLine();
        /**影子青蛙 */
        //	let shadowFrog = this.m_createAllFrogs.findFrogById(DataProl.shadowFrogId);
        if (this.m_shadowFrog != null) {
            if (this.yaogan.pos.x == 0 && this.yaogan.pos.y == 0)
                return;
            this.game_Loop_tmp_point.setTo(this.yaogan.pos.x, this.yaogan.pos.y);
            this.game_Loop_tmp_point.normalize(this.m_shadowFrog.speed);
            this.game_Loop_tmp_point.setTo(Math.floor(this.game_Loop_tmp_point.x), Math.floor(this.game_Loop_tmp_point.y));
            this.game_Loop_tmp_point.x = Math.floor(this.game_Loop_tmp_point.x * 10) * 0.1;
            this.game_Loop_tmp_point.y = Math.floor(this.game_Loop_tmp_point.y * 10) * 0.1;
            /**影子青蛙移动 */
            //	this.m_shadowFrog .setTargetPoint(this.game_Loop_tmp_point);
            this.m_shadowFrog.frogVeer();
            this.m_shadowFrog.shadowFrogMoveto(this.game_Loop_tmp_point);
        }
    };
    multGame.prototype.resetShadowForgStates = function () {
        serverConfig.config.shadowFrog = 1;
    };
    /**视野变化 */
    multGame.prototype.visualChange = function () {
        var myFrog = this.m_createAllFrogs.findFrogById(DataProl.account);
        if (myFrog != null)
            this.scaleX = this.scaleY = 1 - myFrog.frogLineLength / 45000;
    };
    /**玩家伸舌 */
    multGame.prototype.playerLoll = function () {
        this.m_createAllFrogs.frogLoll();
    };
    /**处理玩家伸舌 */
    multGame.prototype.dellPlayerShoot = function (user) {
        if (user.account != DataProl.account) {
            //吐舌广播
            this.m_createAllFrogs.showShoot(user);
            //动画广播
            this.m_createAllFrogs.tweenshoot(user);
        }
        else {
            this.m_createAllFrogs.tweenshoot(user);
        }
    };
    /**检测是否可以断线 */
    multGame.prototype.check_can_breakLine = function () {
        if (this.m_createAllFrogs.checkPlayerIsLine()) {
            this.playerPanel.coolDown.visible = false;
            this.playerPanel.breakLine.visible = true;
            this.playerPanel.ligature.visible = false;
        }
        else {
            this.playerPanel.breakLine.visible = false;
            this.playerPanel.ligature.visible = true;
        }
    };
    /**发送心跳 */
    multGame.prototype.sendHeart = function () {
        var m_AwesomeMessage = new awesomepackage.AwesomeMessage();
        m_AwesomeMessage.meesageId = 100;
        var buffer = awesomepackage.AwesomeMessage.encode(m_AwesomeMessage).finish();
        var byte2 = new egret.ByteArray(buffer);
        webNetworkMananger.getInstance().SendBitMeesage(byte2);
    };
    /**定时器*/
    multGame.prototype.BeginTimes = function () {
        this.game_Timer = new egret.Timer(1000 / 60, -1);
        this.game_Timer.addEventListener(egret.TimerEvent.TIMER, this.game_Loop, this);
        this.game_Timer.start();
    };
    /**处理服务器发来的消息 */
    multGame.prototype.handleInformationByServer = function (playerdata) {
        if (!webNetworkMananger.isServerMove) {
            return;
        }
        //整理玩家的位置/装扮/状态/道具开始时间
        for (var i = 0; i < playerdata.userData.length; i++) {
            playerdata.userData[i].x = playerdata.userData[i].x * 0.1;
            playerdata.userData[i].y = playerdata.userData[i].y * 0.1;
            playerdata.userData[i].Dressup.decorateId -= 1;
            playerdata.userData[i].Dressup.trailingId -= 1;
            playerdata.userData[i].propStates.getPropType -= 1;
            playerdata.userData[i].propStates.PropStartTime -= 1;
        }
        //整理线的信息
        for (var i = 0; i < playerdata.lineList.length; i++) {
            playerdata.lineList[i].uop.x = playerdata.lineList[i].uop.x * 0.1;
            playerdata.lineList[i].utp.x = playerdata.lineList[i].utp.x * 0.1;
            playerdata.lineList[i].uop.y = playerdata.lineList[i].uop.y * 0.1;
            playerdata.lineList[i].utp.y = playerdata.lineList[i].utp.y * 0.1;
        }
        //	playerdata.userData[i].timeStamp = playerdata.timeStamp;
        //	this.sendHeart();
        /**线的数据 */
        var lineData = playerdata.lineList;
        /**玩家数据 */
        var userData = playerdata.userData;
        /**判断是否复活 */
        if (this.isUserDied) {
            var isResurgence = this.checkUserResurgence(userData);
            if (!isResurgence) {
                return;
            }
            else {
                this.isUserDied = false;
            }
        }
        if (userData != null) {
            // /**玩家排行榜 */
            // this.playerPanel.disposAllUser(userData);
            //处理青蛙的移动
            //	console.log("ttttt"+userData[0].x);
            this.m_createAllFrogs.disposeRoomUserMessage(userData);
        }
        if (lineData != null) {
            /**处理玩家身上的线 */
            this.tongueManager.gameTongueDataUpdata(userData, lineData);
            if (lineData.length > 0) {
                this.checkUserLineNumber(lineData);
            }
        }
    };
    /**检测玩家连线数量 */
    multGame.prototype.checkUserLineNumber = function (lineData) {
        for (var i = 0; i < lineData.length; i++) {
            if (lineData[i].userOneId == DataProl.account) {
                if (DataProl.connectionNumber.length > 0) {
                    for (var j = 0; j < DataProl.connectionNumber.length; j++) {
                        if (DataProl.connectionNumber[j] == lineData[i].userTwoId) {
                            return;
                        }
                    }
                    DataProl.connectionNumber.push(lineData[i].userTwoId);
                }
                else {
                    DataProl.connectionNumber.push(lineData[i].userTwoId);
                }
            }
            else if (lineData[i].userTwoId == DataProl.account) {
                if (DataProl.connectionNumber.length > 0) {
                    for (var j = 0; j < DataProl.connectionNumber.length; j++) {
                        if (DataProl.connectionNumber[j] == lineData[i].userOneId) {
                            return;
                        }
                    }
                    DataProl.connectionNumber.push(lineData[i].userOneId);
                }
                else {
                    DataProl.connectionNumber.push(lineData[i].userOneId);
                }
            }
        }
    };
    /**处理青蛙断线反作用力 */
    multGame.prototype.disposeCounterforce = function (data) {
        if (data.shootObjStates == null && data.shootObjStates == undefined) {
            console.log("消息类型为空");
            return;
        }
        if (data.shootObjStates == 1) {
            this.m_createAllFrogs.frogCounterforce(data);
        }
        if (data.shootObjStates == 2) {
            this.m_createAllFrogs.frogFlick(data);
        }
    };
    multGame.prototype.checkUserResurgence = function (userData) {
        for (var i = 0; i < userData.length; i++) {
            if (userData[i].userId == DataProl.account && !userData[i].Death.isDeath) {
                return true;
            }
        }
        return false;
    };
    /**将玩家信息显示出来 */
    multGame.prototype.displaMyInfo = function (player) {
        this.playerPanel.displayUserTongueLength(player.lineLength);
        var playertyp = player.frogType + 1 >= serverConfig.config.maxtype + 1 ? 0 : player.frogType + 1;
        this.playerPanel.displayUserClothesUpdata(playertyp);
    };
    multGame.prototype.yaoganInit = function () {
        this.yaogan = new roleControl();
        this.UiLayer.addChild(this.yaogan);
        this.yaogan.yaoganInit(this.stage);
    };
    /**显示击杀效果 */
    multGame.prototype.disPlayKillMan = function (num) {
        if (num > DataProl.killnumMax) {
            DataProl.killnumMax = num;
        }
        //console.log(DataProl.killnumMax + "最高连杀");
        //this.playerPanel.frogKillMan(num);
        SoundManager.getInstance().effectSound = null;
        SoundManager.getInstance().playEffectSound("Kill_mp3");
    };
    // 发送给服务器玩家的位置
    multGame.prototype.senMessageForServerPosition = function (point) {
        //道具醉酒
        if (this.myUser.userSprit.nowPropsType[3] == 4) {
            if (Date.now() - this.daotime >= 1000) {
                this.rr = Math.round(Math.random() * 360);
                this.daotime = Date.now();
            }
            point.x = Math.sin(this.rr / 57.3) * 815;
            point.y = Math.cos(this.rr / 57.3) * 815;
        }
        if (point.y == 0 && point.x == 0) {
            //console.log("发送位置为零");
            return;
        }
        var movedata = {
            "target": point,
            "account": DataProl.account,
        };
        //12,这几个汉字的utf-8编码都占三个字节  
        //	console.log("发送玩家数据");
        //	webNetworkMananger.getInstance().SendMeesage('playerMove', movedata);
        var m_AwesomeMessage = new awesomepackage.AwesomeMessage();
        var m_c2sPlayerMove = new awesomepackage.c2sPlayerMove();
        m_c2sPlayerMove.account = DataProl.account;
        // this.tmpPoint.x = point.x;
        // this.tmpPoint.y = point.y;
        // this.tmpPoint.normalize(1);
        // m_c2sPlayerMove.targetx = 	this.tmpPoint.x;
        // m_c2sPlayerMove.targety =	this.tmpPoint.y;
        //	let shadowFrog = this.m_createAllFrogs.findFrogById(DataProl.shadowFrogId);
        if (this.m_shadowFrog != null) {
            //	shadowFrog.isv
            m_c2sPlayerMove.x = this.m_shadowFrog.x;
            m_c2sPlayerMove.y = this.m_shadowFrog.y;
        }
        else {
            m_c2sPlayerMove.x = -1;
            m_c2sPlayerMove.y = -1;
        }
        m_c2sPlayerMove.targetx = point.x;
        m_c2sPlayerMove.targety = point.y;
        m_AwesomeMessage.meesageId = 1003;
        var buffer1 = awesomepackage.c2sPlayerMove.encode(m_c2sPlayerMove).finish();
        var deflate = new Zlib.Deflate(buffer1);
        var compressed = deflate.compress();
        m_AwesomeMessage.data = compressed;
        var buffer = awesomepackage.AwesomeMessage.encode(m_AwesomeMessage).finish();
        var byte2 = new egret.ByteArray(buffer);
        webNetworkMananger.getInstance().SendBitMeesage(byte2);
    };
    /**加载图片
     * posx/posy 坐标
     * rotate 旋转角度
     * name 名字
     * scale 大小
     * isClear 是否可刷新
     */
    multGame.prototype.loadingImage = function (posx, posy, rotate, name, scale, isClear) {
        var loadimage = new eui.Image();
        loadimage.texture = RES.getRes(name);
        loadimage.x = posx;
        loadimage.y = posy;
        loadimage.rotation = rotate;
        loadimage.scaleX = scale;
        loadimage.scaleY = scale;
        isClear ? this.tongueLayer.addChild(loadimage) : this.addChild(loadimage);
    };
    //提交玩家自己的青蛙
    multGame.prototype.creatMyFog = function () {
        this.m_createAllFrogs.getMyFrog(DataProl.account, DataProl.login_data.nickName, 550, 500, 0, 0, DataProl.userCurrentDressUp);
        this.myUser.targetx = this.myUser.userSprit.x;
        this.myUser.targety = this.myUser.userSprit.y;
    };
    /**返回大厅 */
    multGame.prototype.backToHall = function () {
        this.game_Timer.removeEventListener(egret.TimerEvent.TIMER, this.game_Loop, this);
        this.game_Timer.reset();
        //添加层级处理
        this.removeUnusedLayer();
        SceneManager.instance.SitchScene(SceneName.登录场景);
        this.clearAll(); //测试返回按钮时调用清空数据方法
        console.log("玩家返回大厅...");
    };
    multGame.prototype.removeUnusedLayer = function () {
        if (this.UiLayer == null)
            return;
        if (this.playerPanel != null) {
            this.UiLayer.removeChild(this.playerPanel);
            this.playerPanel = null;
        }
        if (this.userDied != null) {
            this.UiLayer.removeChild(this.userDied);
            this.userDied = null;
        }
        if (this.GameOver != null) {
            this.UiLayer.removeChild(this.GameOver);
            this.GameOver = null;
        }
        if (this.yaogan != null) {
            this.UiLayer.removeChild(this.yaogan);
            this.yaogan = null;
        }
        if (this.parent != null) {
            this.parent.removeChild(this.UiLayer);
            this.UiLayer = null;
        }
    };
    /**清空multGame数据 */
    multGame.prototype.clearAll = function () {
        this.yaogan = null;
        this.camera = null;
        this.daotime = null;
        this.rr = null;
        this.background = null;
        this.clothes_List = null;
        this.myControlPoint = null;
        this.handle = null;
        this.circle = null;
        this.circle_position = null;
        this.handle_position = null;
        this.touchID = null;
        this.circle_radius = null;
        this.handle_radius = null;
        this.jiaodu = null;
        this.container = null;
        this.gameMapss = null;
        this.tmpPoint = null;
        this.bgSound = null;
        this.con = null;
        this.player = null;
        //this.myUser=null;//第一个注掉后，multGame里返回大厅方法backToHall可直接使用
        this.decoration_List = null;
        this.tongueLayer = null;
        this.propLayer = null;
        this.UiLayer = null;
        this.GameOver = null;
        this.userDied = null;
        this.playerPanel = null;
        this.gameFrog = null;
        this.m_createAllFrogs = null;
        this.roomAllTongue = null;
        this.tongueManager = null;
        this.game_Timer = null;
        this.isUserDied = null;
        this.m_propMg = null;
        this.m_shadowFrog = null;
        this.game_Loop_tmp_point = null;
        webNetworkMananger.getInstance().gameSceneRec = null;
    };
    return multGame;
}(eui.Component));
__reflect(multGame.prototype, "multGame");
/**
 * 场景管理类
 */
var SceneManager = (function () {
    /**构造 */
    function SceneManager() {
        /**场景列表 */
        this.sceneItem = [];
    }
    Object.defineProperty(SceneManager, "instance", {
        /**获取实例对象 */
        get: function () {
            if (!this.sceneManager) {
                this.sceneManager = new SceneManager();
            }
            return this.sceneManager;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * 设置根场景
     * @param s 根场景
     */
    SceneManager.prototype.setStage = function (s) {
        this._stage = s;
    };
    /** 删除其他场景*/
    SceneManager.prototype.removeOther = function () {
        for (var i = 0; i < this.sceneItem.length; i++) {
            if (this.sceneItem[i].parent) {
                this._stage.removeChild(this.sceneItem[i]);
                this.sceneItem[i] = null;
                this.sceneItem.splice(i, 1);
            }
        }
    };
    /**切换场景 */
    SceneManager.prototype.SitchScene = function (sceneName) {
        this.removeOther();
        /**场景临时变量 */
        var scene;
        switch (sceneName) {
            case SceneName.登录场景:
                scene = new LoginMain();
                break;
            case SceneName.新手引导:
                scene = new xinshou();
                break;
            case SceneName.单机场景:
                scene = new singleGame();
                break;
            case SceneName.联网场景:
                scene = new multGame();
                break;
            default:
                break;
        }
        if (scene) {
            this.sceneItem.push(scene);
            this._stage.addChild(scene);
        }
    };
    return SceneManager;
}());
__reflect(SceneManager.prototype, "SceneManager");
var SceneName;
(function (SceneName) {
    SceneName[SceneName["\u767B\u5F55\u573A\u666F"] = 0] = "\u767B\u5F55\u573A\u666F";
    SceneName[SceneName["\u5355\u673A\u573A\u666F"] = 1] = "\u5355\u673A\u573A\u666F";
    SceneName[SceneName["\u8054\u7F51\u573A\u666F"] = 2] = "\u8054\u7F51\u573A\u666F";
    SceneName[SceneName["\u65B0\u624B\u5F15\u5BFC"] = 3] = "\u65B0\u624B\u5F15\u5BFC";
})(SceneName || (SceneName = {}));
// import * as im from "../ymVoice/ymMgr";
/**
 * 用于单机游戏
 */
var singleGame = (function (_super) {
    __extends(singleGame, _super);
    /**创建 */
    function singleGame() {
        var _this = _super.call(this) || this;
        /**四号道具 */
        _this.daotime = Date.now();
        _this.rr = 0;
        _this.background = new eui.Group();
        _this.brorder = new eui.Group();
        /**玩家类型 */
        _this.clothes_List = ["lv", "huang", "qing"];
        //保存玩家的位置
        _this.myControlPoint = {
            x: 0,
            y: 0
        };
        //用于手柄部分
        _this.handle = new eui.Image(); //小球
        _this.circle = new eui.Image(); //圈
        _this.circle_position = { "x": 100, "y": gameGlobal.global.screenHeight - 100 }; //圈中心点的位置
        _this.handle_position = { "x": 100, "y": gameGlobal.global.screenHeight - 100 }; //小球中心店的位置
        _this.touchID = null; //触摸id
        _this.circle_radius = 0;
        _this.handle_radius = 0;
        _this.jiaodu = 0; //返回角度
        _this.isShowTop = false;
        /**背景音乐 */
        //	private bgSound: soundMgr = new soundMgr();
        /**AI管理类 */
        //private aimgr: AIMgr;
        /**用于存储玩家是否死亡 控制是否接受服务器消息 */
        _this.isUserDied = false;
        /**相关数据 */
        _this.con = gameGlobal;
        _this.config = _this.con.global; //account
        /**玩家信息 */
        _this.player = {
            id: -DataProl.playerOpenid,
            x: _this.config.screenWidth / 2,
            y: _this.config.screenHeight / 2,
            type: Math.round(Math.random() * 2 + 0),
            screenWidth: _this.config.screenWidth,
            screenHeight: _this.config.screenHeight,
            target: { x: _this.config.screenWidth / 2, y: _this.config.screenHeight / 2 },
            name: gameGlobal.global.playerName,
            hue: null,
            massTotal: null,
            cells: null,
            xoffset: -0,
            yoffset: -0
        };
        //显示玩家的青蛙
        _this.myUser = { targetx: 0, targety: 0, userSprit: null };
        /**装饰品 */
        _this.decoration_List = ["lowpoly", "food"];
        /**线层*/
        _this.tongueLayer = new egret.Sprite();
        /**道具层 */
        _this.propLayer = new egret.Sprite();
        /**UI层 */
        _this.UiLayer = new eui.Component();
        /**游戏结束/死亡*/
        _this.GameOver = new GameOver();
        /**玩家面板信息/用于显示玩家信息 */
        _this.playerPanel = new playerPanel(_this);
        /**；存房间玩家/青蛙 动画的容器 */
        _this.gameFrog = new eui.Group();
        /**青蛙管理类 */
        _this.m_createAllFrogs = new frogMgr(_this);
        /**房间内的线 */
        _this.roomAllTongue = new egret.Sprite();
        /**玩家死亡 */
        _this.userDied = new playerDied();
        /**道具管理 */
        _this.m_propMg = new propMgr(_this.propLayer);
        /**游戏循环定时器 */
        _this.moveLoop = new egret.Timer(1000 / 60, -1);
        _this.game_TimerT = new egret.Timer(1000, -1);
        _this.game_Loop_tmp_point = new egret.Point(0, 0);
        _this.game_Loop_Log_tmp_point = new egret.Point(0, 0);
        /**左上角坐标 */
        _this.topLeftCorner = new egret.Point(0, 0);
        /**右上角坐标 */
        _this.topRightCorner = new egret.Point(0, 0);
        /**左下角坐标 */
        _this.downLeftCorner = new egret.Point(0, 0);
        /**右下角坐标 */
        _this.downRightCorner = new egret.Point(0, 0);
        _this.nodetmp = new egret.Point(0, 0);
        _this.checkTeammatenodetmp = new egret.Point(0, 0);
        _this.timeOnEnterFrame = 0;
        _this.time = 0;
        _this.tongueManager = new tongueMgr(_this.roomAllTongue, _this.m_createAllFrogs);
        _this.skinName = "resource/assets/skins/gameMapSkin.exml";
        _this.once(egret.Event.ADDED_TO_STAGE, _this.initialize, _this);
        return _this;
    }
    /**初始化 */
    singleGame.prototype.initialize = function () {
        resManager.getInstance().loadRes();
        this.init();
        this.yaoganInit();
        this.parent.addChild(this.UiLayer);
        this.UiLayer.addChild(this.playerPanel);
        this.gameStart();
        this.changeVisibility(DataProl.gameSceneScal);
        // for (var i: number = 0; i < 6; i++) {//背景添加六边形
        // 	for (var t: number = 0; t < 7; t++) {
        // 		var bit: eui.Image = new eui.Image();
        // 		bit.texture = RES.getRes("liubianxing22_png");
        // 		bit.x = 496 * t + 248 * (i % 2);
        // 		bit.y = 431.25 * i;
        // 		this.liubianxing.addChild(bit);
        // 	}
        // }
    };
    Object.defineProperty(singleGame.prototype, "User", {
        get: function () {
            return this.myUser.userSprit;
        },
        enumerable: true,
        configurable: true
    });
    //定时调用AIserver MOVE
    singleGame.prototype.AIServerUpdate = function (event) {
        AIServer.getInstance().updata();
        AIServer.getInstance().gameLoops();
        this.game_Loop();
        event.updateAfterEvent();
    };
    singleGame.prototype.init = function () {
        //this.resetShadowForgStates();
        DataProl.killnumMax = 0;
        this.mapScaleInit();
        webNetworkMananger.getInstance().gameSceneRec = this;
        this.m_createAllFrogs.createAllFrogs();
        if (serverConfig.config.shadowFrog == 1) {
            //影子青初始化
            var shadowFrog = this.m_createAllFrogs.findFrogById(DataProl.shadowFrogId);
            if (shadowFrog != null) {
                shadowFrog.reset();
            }
            this.m_shadowFrog = this.m_createAllFrogs.getOneFrog();
            this.m_shadowFrog.born(DataProl.shadowFrogId, "影子", 200, 200, 1, 1, null);
            this.m_shadowFrog.visble = true;
        }
        this.mapInit();
        this.cameraInit();
        this.creatMyFog();
        this.UiLayer.width = GlobalData.GameStage_width * DataProl.gameSceneScal;
        this.UiLayer.height = GlobalData.GameStage_height * DataProl.gameSceneScal;
        this.UiLayer.addChild(this.userDied);
        this.UiLayer.addChild(this.GameOver);
        this.GameOver.visible = false;
        this.userDied.visible = false;
        //this.drawMap();8
    };
    singleGame.prototype.drawMap = function () {
        DrawMap.drawLineToGroup(this.drawGroup);
        /**打开  将方法里的变量修改下 */
        // DrawMap.drawHexagonToGroup(this.drawGroup);
        this.setChildIndex(this.drawGroup, 4);
        this.drawGroup.cacheAsBitmap = true; /**不要改 */
    };
    /**地图缩放初始化 */
    singleGame.prototype.mapScaleInit = function () {
        var scaleLayer = dynamicScaling.dynamicLayer;
        this.addChild(scaleLayer);
        this.changeParent("map");
        this.changeParent("background");
        this.changeParent("shitou");
        this.changeParent("brorder");
    };
    /**
     * 改变父节点  仅限于此使用
     */
    singleGame.prototype.changeParent = function (childName) {
        var obj = this.getChildByName(childName);
        this.removeChild(obj);
        dynamicScaling.addScalingObject(obj);
    };
    /**改变游戏内可见范围大小
     * vis: 屏幕缩放比例
     */
    singleGame.prototype.changeVisibility = function (vis) {
        egret.MainContext.instance.stage.setContentSize(gameGlobal.global.screenWidth * vis, gameGlobal.global.screenHeight * vis);
        //this.yaogan.changeVis(vis);
        //this.camera.changeVis(vis);
        this.playerPanel.changeVis(vis);
        this.GameOver.changeVis(vis);
        this.userDied.changeVis(vis);
        //this.swapChildren(this.playerPanel, this.yaogan);//改变摇杆和遮罩进游戏动画的深度，进游戏后摇杆在前
    };
    singleGame.prototype.gameStart = function () {
        AIServer.getInstance().roomInit();
        AIServer.getInstance().yaogan = this.yaogan;
        this.BeginTimes();
        //this.myUser.userSprit = this.m_createAllFrogs.findFrogById(DataProl.account);
        DataProl.roomTime = serverConfig.config.roomTime;
        DataProl.roomStartTime = (new Date()).valueOf();
        this.playerPanel.startRoomTimer();
    };
    /*返回大厅 */
    singleGame.prototype.backToHall = function () {
        //this.playerPanel.countDownTime = serverConfig.config.roomTime;//房间死亡不复活回大厅时间处理
        this.gameRest();
        //UIManager.getInstance().openFirstUI(UIManager.CLASS_UI_INDEX_LOGINMAIN);
        egret.MainContext.instance.stage.setContentSize(gameGlobal.global.screenWidth, gameGlobal.global.screenHeight);
        if (this.yaogan != null) {
            /**移除监听 避免一直发消息 */
            this.yaogan.clearYaogan();
            //添加层级处理
            this.removeUnusedLayer();
            SceneManager.instance.SitchScene(SceneName.登录场景);
        }
    };
    singleGame.prototype.removeUnusedLayer = function () {
        if (this.UiLayer == null)
            return;
        if (this.playerPanel != null) {
            this.UiLayer.removeChild(this.playerPanel);
            this.playerPanel = null;
        }
        if (this.userDied != null) {
            this.UiLayer.removeChild(this.userDied);
            this.userDied = null;
        }
        if (this.GameOver != null) {
            this.UiLayer.removeChild(this.GameOver);
            this.GameOver = null;
        }
        if (this.yaogan != null) {
            this.UiLayer.removeChild(this.yaogan);
            this.yaogan = null;
        }
        if (this.parent != null) {
            this.parent.removeChild(this.UiLayer);
            this.UiLayer = null;
        }
        if (this.propLayer != null) {
            dynamicScaling.dynamicLayer.removeChild(this.propLayer);
            this.propLayer = null;
        }
        if (this.gameFrog != null) {
            dynamicScaling.dynamicLayer.removeChild(this.gameFrog);
            this.gameFrog = null;
        }
        if (this.roomAllTongue != null) {
            dynamicScaling.dynamicLayer.removeChild(this.roomAllTongue);
            this.roomAllTongue = null;
        }
        if (this.map != null) {
            dynamicScaling.dynamicLayer.removeChild(this.map);
            this.map = null;
        }
        if (this.background != null) {
            dynamicScaling.dynamicLayer.removeChild(this.background);
            this.background = null;
        }
        if (this.shitou != null) {
            dynamicScaling.dynamicLayer.removeChild(this.shitou);
            this.shitou = null;
        }
        if (this.brorder != null) {
            dynamicScaling.dynamicLayer.removeChild(this.brorder);
            this.brorder = null;
        }
    };
    singleGame.prototype.gameRest = function () {
        //this.removeEventListener(egret.Event.ENTER_FRAME, this.game_Loop, this);
        this.moveLoop.removeEventListener(egret.TimerEvent.TIMER, this.AIServerUpdate, this);
        this.moveLoop.reset();
        this.game_TimerT.removeEventListener(egret.TimerEvent.TIMER, this.showTip, this);
        this.game_TimerT.reset();
        // this.game_Timer.removeEventListener(egret.TimerEvent.TIMER, this.game_Loop, this);
        // this.game_Timer.reset();
        egret.stopTick(this.moveStar, this);
        AIServer.getInstance().gameOver();
    };
    singleGame.prototype.gameAgain = function () {
        DataProl.killnumMax = 0;
        this.gameRest();
        this.gameStart();
    };
    /**
     * 摄像机初始化
     */
    singleGame.prototype.cameraInit = function () {
        var cameraRect = new egret.Rectangle(0, 0, GlobalData.GameStage_width * DataProl.gameSceneScal, GlobalData.GameStage_height * DataProl.gameSceneScal);
        this.camera = new control.Camera2D(this, cameraRect);
    };
    singleGame.prototype.onLoop = function () {
        this.camera.move();
    };
    /**地图初始化 */
    singleGame.prototype.mapInit = function () {
        /*房间的线 */
        dynamicScaling.addScalingObject(this.roomAllTongue);
        /**房间内的道具 */
        dynamicScaling.addScalingObject(this.propLayer);
        /**房间内的青蛙 */
        dynamicScaling.addScalingObject(this.gameFrog);
    };
    /**玩家死亡 */
    singleGame.prototype.playerDiedDis = function () {
        var User_list = AIServer.getInstance().getRoomUsers();
        this.GameOver.visible = true;
        this.GameOver.showTops(User_list);
        this.userDied.GameOverDis();
    };
    /**游戏循环 */
    singleGame.prototype.game_Loop = function () {
        var pass = (egret.getTimer() - this.timeOnEnterFrame);
        //this.aimgr.update();
        //this.accordingLineData();
        //this.displaMyInfo(this.myUser.userSprit);
        //this.playerUpdate();
        //this.checkDied();
        //this.yaogan.sendPosition();
        //	this.visualChange();
        this.check_can_breakLine();
        //this.tongueManager.updataTongue();
        this.checkTeammateInMap();
        /**影子青蛙移动 */
        //	let shadowFrog = this.m_createAllFrogs.findFrogById(DataProl.shadowFrogId);
    };
    /**重置影子青蛙状态 */
    singleGame.prototype.resetShadowForgStates = function () {
        serverConfig.config.shadowFrog = 1;
    };
    /**视野变化 */
    singleGame.prototype.visualChange = function () {
        var myFrog = this.m_createAllFrogs.findFrogById(DataProl.account);
        if (myFrog != null)
            this.scaleX = this.scaleY = 1 - myFrog.frogLineLength / 45000;
    };
    /**检查青蛙是否在地图上(队友指示箭头)*/
    singleGame.prototype.checkTeammateInMap = function () {
        if (this.m_createAllFrogs.checkPlayerIsLine()) {
            /**队友id */
            var teammateId = this.m_createAllFrogs.getLigatureUserId(DataProl.account);
            if (teammateId == null) {
                return;
            }
            /**队友 */
            var teammate = this.m_createAllFrogs.findFrogById(teammateId);
            if (teammate == null) {
                return;
            }
            /**队友基于舞台的坐标 */
            var teammateByStage = teammate.parent.localToGlobal(teammate.x, teammate.y, this.checkTeammatenodetmp);
            if (teammateByStage.x > 0 && teammateByStage.x < this.stage.stageWidth && teammateByStage.y > 0 && teammateByStage.y < this.stage.stageHeight) {
                this.playerPanel.teammateMark.visible = false;
                this.playerPanel.frogTag.visible = false;
                return;
            }
            /**我自己的青蛙 */
            var myFrog = this.m_createAllFrogs.findFrogById(DataProl.account);
            if (myFrog == null) {
                return;
            }
            /**自己青蛙基于舞台的坐标 */
            var myFrogByGlobal = myFrog.parent.localToGlobal(myFrog.x, myFrog.y);
            //console.log("队友基于舞台的坐标:" + Math.floor(teammateByStage.x) + "---------" + Math.floor(teammateByStage.y));
            //console.log("舞台边界：" + this.stage.stageHeight);
            /**箭头角度 */
            var angle = Util.getInstance().getRotation(myFrogByGlobal, teammateByStage);
            // console.log("箭头角度：" + angle);
            /**坐标偏移值 */
            var coordinateOffset = 5;
            /**左上角坐标 */
            this.topLeftCorner.setTo(coordinateOffset, coordinateOffset);
            /**右上角坐标 */
            this.topRightCorner.setTo(this.stage.stageWidth - coordinateOffset, coordinateOffset);
            /**左下角坐标 */
            this.downLeftCorner.setTo(coordinateOffset, this.stage.stageHeight - coordinateOffset);
            /**右下角坐标 */
            this.downRightCorner.setTo(this.stage.stageWidth - coordinateOffset, this.stage.stageHeight - coordinateOffset);
            /**交点 */
            var node = void 0;
            //上线交点
            node = Util.getInstance().segmentsIntr(teammateByStage, myFrogByGlobal, this.topLeftCorner, this.topRightCorner);
            if (node != false) {
                this.playerPanel.teammateMarkUpdate(this.nodetmp.setTo(node.x, node.y), angle, 1);
                return;
            }
            //左线交点
            node = Util.getInstance().segmentsIntr(teammateByStage, myFrogByGlobal, this.topLeftCorner, this.downLeftCorner);
            if (node != false) {
                this.playerPanel.teammateMarkUpdate(this.nodetmp.setTo(node.x, node.y), angle, 4);
                return;
            }
            //下线交点
            node = Util.getInstance().segmentsIntr(teammateByStage, myFrogByGlobal, this.downLeftCorner, this.downRightCorner);
            if (node != false) {
                this.playerPanel.teammateMarkUpdate(this.nodetmp.setTo(node.x, node.y), angle, 3);
                return;
            }
            //右线交点
            node = Util.getInstance().segmentsIntr(teammateByStage, myFrogByGlobal, this.topRightCorner, this.downRightCorner);
            if (node != false) {
                this.playerPanel.teammateMarkUpdate(this.nodetmp.setTo(node.x, node.y), angle, 2);
                return;
            }
        }
        else {
            this.playerPanel.teammateMark.visible = false;
            this.playerPanel.frogTag.visible = false;
        }
    };
    /**玩家伸舌 */
    singleGame.prototype.playerLoll = function () {
        this.m_createAllFrogs.frogLoll();
    };
    /**检测是否可以断线 */
    singleGame.prototype.check_can_breakLine = function () {
        if (this.m_createAllFrogs.checkPlayerIsLine()) {
            this.playerPanel.coolDown.visible = false;
            this.playerPanel.breakLine.visible = true;
            this.playerPanel.ligature.visible = false;
        }
        else {
            this.playerPanel.breakLine.visible = false;
            this.playerPanel.ligature.visible = true;
        }
    };
    /**定时器*/
    singleGame.prototype.BeginTimes = function () {
        // this.game_Timer = new egret.Timer(1000 / 30, -1);
        // this.game_Timer.addEventListener(egret.TimerEvent.TIMER, this.game_Loop, this);
        // this.game_Timer.start();
        //this.addEventListener(egret.Event.ENTER_FRAME, this.game_Loop, this);
        this.moveLoop.addEventListener(egret.TimerEvent.TIMER, this.AIServerUpdate, this);
        this.moveLoop.start();
        if (serverConfig.config.shadowFrog == 1) {
            egret.startTick(this.moveStar, this);
        }
        this.timeOnEnterFrame = egret.getTimer();
        this.testPP();
        this.game_TimerT.addEventListener(egret.TimerEvent.TIMER, this.showTip, this);
        this.game_TimerT.start();
    };
    singleGame.prototype.testPP = function () {
        var count = egret.$hashCount;
        setInterval(function () {
            var newCount = egret.$hashCount;
            var diff = newCount - count;
            count = newCount;
            console.log(diff);
        }, 1000);
    };
    singleGame.prototype.moveStar = function (timeStamp) {
        var now = timeStamp;
        var time = this.time;
        var passt = now - time;
        // console.log("moveStar: ", (1000 / passt).toFixed(5));
        // console.log("pass: ", passt * 0.03);
        this.m_shadowFrog.x += (passt * 0.03); //(1 * pass*0.1);
        this.time = now;
        return false;
    };
    singleGame.prototype.showTip = function () {
        this.isShowTop = true;
        AIServer.getInstance().gameLoops();
    };
    /**处理服务器发来的消息 */
    singleGame.prototype.handleInformationByServer = function (playerdata) {
        if (this.isUserDied)
            return;
        //	this.playerPanel.serverHertBeatUpdata((new Date()).valueOf());//(Date.parse(new Date().toString()));
        var porpsData = playerdata.foodsList;
        var lineData = playerdata.lineList;
        var userData = playerdata.userData;
        var virusData = playerdata.virusList;
        if (porpsData != null) {
            /**更新道具 */
            this.m_propMg.propsUpdata(porpsData);
        }
        if (userData != null) {
            if (this.isShowTop) {
                /**玩家排行榜 */
                this.playerPanel.disposAllUser(userData);
                this.isShowTop = false;
            }
            //处理青蛙的移动
            this.m_createAllFrogs.disposeRoomUserMessage(userData);
            this.changebutton(userData);
            //this.diedLeaf(userData);
        }
        if (lineData != null) {
            /**处理玩家身上的线 */
            this.tongueManager.gameTongueDataUpdata(userData, lineData);
            //this.newTongueMgr.disposeRoomTongueMessage(userData, lineData);
        }
        this.onLoop();
    };
    /**飞行动画中关闭吐舌 断线按钮 */
    singleGame.prototype.changebutton = function (userData) {
        for (var _i = 0, userData_1 = userData; _i < userData_1.length; _i++) {
            var e = userData_1[_i];
            if (e.userId == DataProl.account) {
                if (e.states != 0) {
                    this.playerPanel.breakLine.alpha = 0;
                    this.playerPanel.breakLine.visible = false;
                    this.playerPanel.ligature.alpha = 0;
                    this.playerPanel.ligature.visible = false;
                }
                else {
                    this.playerPanel.breakLine.alpha = 1;
                    this.playerPanel.breakLine.visible = true;
                    this.playerPanel.ligature.alpha = 1;
                    this.playerPanel.ligature.visible = true;
                }
            }
        }
    };
    /**显示击杀效果 */
    singleGame.prototype.disPlayKillMan = function (num) {
        var _this = this;
        var time11 = new egret.Timer(1200, 1);
        time11.start();
        time11.addEventListener(egret.TimerEvent.TIMER, function (eve) {
            var visible = DataProl.gameSceneScal + _this.lenght11 / 2500;
            if (visible >= 2) {
                visible = 2;
            }
        }, this);
        if (num > DataProl.killnumMax) {
            DataProl.killnumMax = num;
        }
        //console.log(DataProl.killnumMax + "最高连杀");
        this.playerPanel.frogKillMan(num);
        SoundManager.getInstance().effectSound = null;
        SoundManager.getInstance().playEffectSound("Kill_mp3");
    };
    /**将玩家信息显示出来 */
    singleGame.prototype.displaMyInfo = function (player) {
        this.lenght11 = player.lineLength;
        this.playerPanel.displayUserTongueLength(player.grade);
        var playertyp = player.frogType + 1 >= serverConfig.config.maxtype + 1 ? 0 : player.frogType + 1;
        this.playerPanel.displayUserClothesUpdata(playertyp);
    };
    singleGame.prototype.yaoganInit = function () {
        this.yaogan = new roleControl();
        this.UiLayer.addChild(this.yaogan);
        this.yaogan.yaoganInit(this.stage);
    };
    // 发送给服务器玩家的位置
    singleGame.prototype.senMessageForServerPosition = function (point) {
        //道具醉酒
        if (this.myUser.userSprit.nowPropsType[3] == 4) {
            if (Date.now() - this.daotime >= 1000) {
                this.rr = Math.round(Math.random() * 360);
                this.daotime = Date.now();
            }
            point.x = Math.sin(this.rr / 57.3) * 815;
            point.y = Math.cos(this.rr / 57.3) * 815;
        }
        if (point.y == 0 && point.x == 0) {
            //console.log("停止");
            return;
        }
        var movedata = {
            "target": point,
        };
        AIServer.getInstance().clientMove(movedata);
    };
    //提交玩家自己的青蛙
    singleGame.prototype.creatMyFog = function () {
        this.m_createAllFrogs.getMyFrog(DataProl.account, DataProl.login_data.nickName, GlobalData.GameStage_width * DataProl.gameSceneScal / 2, GlobalData.GameStage_height * DataProl.gameSceneScal / 2, 0, 11, DataProl.userCurrentDressUp);
        this.myUser.targetx = this.myUser.userSprit.x;
        this.myUser.targety = this.myUser.userSprit.y;
    };
    return singleGame;
}(eui.Component));
__reflect(singleGame.prototype, "singleGame");
var xinshou = (function (_super) {
    __extends(xinshou, _super);
    /**创建 */
    function xinshou() {
        var _this = _super.call(this) || this;
        /**四号道具 */
        _this.daotime = Date.now();
        _this.rr = 0;
        _this.background = new eui.Group();
        _this.brorder = new eui.Group();
        /**玩家类型 */
        _this.clothes_List = ["lv", "huang", "qing"];
        /**道具介绍面板显示次数 */
        _this.prop_messageTimes = 0;
        /**背景音乐 */
        //	private bgSound: soundMgr = new soundMgr();
        /**AI管理类 */
        //private aimgr: AIMgr;
        /**用于存储玩家是否死亡 控制是否接受服务器消息 */
        _this.isUserDied = false;
        /**相关数据 */
        _this.con = gameGlobal;
        _this.config = _this.con.global; //account
        //显示玩家的青蛙
        _this.myUser = { targetx: 0, targety: 0, userSprit: null };
        /**装饰品 */
        _this.decoration_List = ["lowpoly", "food"];
        /**线层*/
        _this.tongueLayer = new egret.Sprite();
        /**道具层 */
        _this.propLayer = new egret.Sprite();
        /**UI层 */
        _this.UiLayer = new eui.Component();
        /**游戏结束/死亡*/
        _this.GameOver = new GameOver();
        /**玩家面板信息/用于显示玩家信息 */
        _this.playerPanel = new playerPanel(_this);
        /**；存房间玩家/青蛙 动画的容器 */
        _this.gameFrog = new eui.Group();
        /**青蛙管理类 */
        _this.m_createAllFrogs = new frogMgr(_this);
        /**房间内的线 */
        _this.roomAllTongue = new egret.Sprite();
        /**玩家死亡 */
        _this.userDied = new playerDied();
        /**道具管理 */
        _this.m_propMg = new propMgr(_this.propLayer);
        //新手引导界面
        _this.sceneType = 1;
        _this.tmptime = new egret.Timer(1000 / 60, -1);
        _this.tongueManager = new tongueMgr(_this.roomAllTongue, _this.m_createAllFrogs);
        /**道具信息数组 */
        _this.text_array = new Array();
        /**道具信息面板数组 */
        _this.message_array = new Array();
        _this.skinName = "resource/assets/skins/gameMapSkin.exml";
        st_config.setScreenAuto(_this);
        _this.addEventListener(egret.Event.ADDED_TO_STAGE, _this.initialize, _this);
        return _this;
    }
    Object.defineProperty(xinshou.prototype, "User", {
        get: function () {
            return this.myUser.userSprit;
        },
        enumerable: true,
        configurable: true
    });
    /**初始化 */
    xinshou.prototype.initialize = function () {
        resManager.getInstance().loadRes();
        this.init();
        this.yaoganInit();
        this.parent.addChild(this.UiLayer);
        this.UiLayer.addChild(this.playerPanel);
        this.gameStart();
        this.changeVisibility(DataProl.gameSceneScal);
        for (var i = 0; i < 6; i++) {
            for (var t = 0; t < 7; t++) {
                var bit = new eui.Image();
                bit.texture = RES.getRes("liubianxing22_png");
                bit.x = 496 * t + 248 * (i % 2);
                bit.y = 431.25 * i;
                this.liubianxing.addChild(bit);
            }
        }
    };
    xinshou.prototype.init = function () {
        //	GlobalData.changeDpi(this);
        DataProl.killnumMax = 0;
        DataProl.isXinShou = true;
        this.mapScaleInit();
        webNetworkMananger.getInstance().gameSceneRec = this;
        this.m_createAllFrogs.createAllFrogs();
        this.mapInit();
        this.cameraInit();
        //this.camera.set
        this.creatMyFog();
        this.camera.setTarget(null);
        this.myFrog = this.m_createAllFrogs.findFrogById(DataProl.account); //获取自己的青蛙
        // this.camera.checkLookAt();
        this.UiLayer.width = GlobalData.GameStage_width * DataProl.gameSceneScal;
        this.UiLayer.height = GlobalData.GameStage_height * DataProl.gameSceneScal;
        this.UiLayer.addChild(this.userDied);
        this.UiLayer.addChild(this.GameOver);
        this.GameOver.visible = false;
        this.userDied.visible = false;
        this.all_Prop_message();
    };
    xinshou.prototype.drawMap = function () {
        DrawMap.drawLineToGroup(this.drawGroup);
        /**打开  将方法里的变量修改下 */
        // DrawMap.drawHexagonToGroup(this.drawGroup);
        this.setChildIndex(this.drawGroup, 4);
        this.drawGroup.cacheAsBitmap = true; /**不要改 */
    };
    /**地图缩放初始化 */
    xinshou.prototype.mapScaleInit = function () {
        var scaleLayer = dynamicScaling.dynamicLayer;
        this.addChild(scaleLayer);
        this.changeParent("map");
        this.changeParent("background");
        this.changeParent("shitou");
        this.changeParent("brorder");
    };
    /**
     * 改变父节点  仅限于此使用
     */
    xinshou.prototype.changeParent = function (childName) {
        var obj = this.getChildByName(childName);
        this.removeChild(obj);
        dynamicScaling.addScalingObject(obj);
    };
    /**改变游戏内可见范围大小
     * vis: 屏幕缩放比例
     */
    xinshou.prototype.changeVisibility = function (vis) {
        egret.MainContext.instance.stage.setContentSize(gameGlobal.global.screenWidth * vis, gameGlobal.global.screenHeight * vis);
        //this.yaogan.changeVis(vis);
        // this.camera.changeVis(vis);
        this.playerPanel.changeVis(vis);
        this.GameOver.changeVis(vis);
        this.userDied.changeVis(vis);
        //this.swapChildren(this.playerPanel, this.yaogan);//改变摇杆和遮罩进游戏动画的深度，进游戏后摇杆在前
    };
    xinshou.prototype.gameStart = function () {
        AIServer.getInstance().roomInit();
        //隐藏新手引导不要的UI
        this.playerPanel.hideGuideUi();
        this.BeginTimes();
        //this.myUser.userSprit = this.m_createAllFrogs.findFrogById(DataProl.account);
        this.playerPanel.startRoomTimer();
        this.playerPanel.gameCountDownTime.visible = false; //同时不显示倒计时
        /**生成六种道具 */
        this.setprop();
        this.yaogan.lockControl();
        /**生成一组连线青蛙 */
        //this.setLinefrog();
        /**生成一个青蛙 */
        //this.setOneAi();
        /**生成一个道具 */
        //this.setOneprop();
        //锁定吐舌
        AIServer.getInstance().setGuidPoint({ x: 200, y: 200 });
        this.lock_shoot();
        //跳过按钮锁定
        this.lock_skip();
        this.tmptime.addEventListener(egret.TimerEvent.TIMER, this.AIServerUpdate, this);
        this.tmptime.start();
        //AIServer.getInstance().updata();
        AIServer.getInstance().yaogan = this.yaogan;
    };
    //执行AIServer中的Updata方法
    xinshou.prototype.AIServerUpdate = function (event) {
        AIServer.getInstance().updata();
    };
    /*返回大厅 */
    xinshou.prototype.backToHall = function () {
        /**移除监听 避免一直发消息 */
        this.yaogan.clearYaogan();
        this.playerPanel.countDownTime = serverConfig.config.roomTime; //房间死亡不复活回大厅时间处理
        this.gameRest();
        SceneManager.instance.SitchScene(SceneName.登录场景);
    };
    xinshou.prototype.gameRest = function () {
        this.game_Timer.removeEventListener(egret.TimerEvent.TIMER, this.game_Loop, this);
        this.game_Timer.reset();
        this.tmptime.removeEventListener(egret.TimerEvent.TIMER, this.AIServerUpdate, this);
        this.tmptime.reset();
        AIServer.getInstance().gameOver();
    };
    xinshou.prototype.gameAgain = function () {
        DataProl.killnumMax = 0;
        this.gameRest();
        this.gameStart();
    };
    /**
     * 摄像机初始化
     */
    xinshou.prototype.cameraInit = function () {
        var cameraRect = new egret.Rectangle(0, 0, GlobalData.GameStage_width * DataProl.gameSceneScal, GlobalData.GameStage_height * DataProl.gameSceneScal);
        this.camera = new control.Camera2D(this, cameraRect);
        // this.camera.addLayer(this.playerPanel);
        // this.camera.addLayer(this.GameOver);
        // this.camera.addLayer(this.yaogan);
        // this.camera.addLayer(this.userDied);
    };
    xinshou.prototype.onLoop = function () {
        this.camera.move(); //相机随青蛙移动
    };
    /**地图初始化 */
    xinshou.prototype.mapInit = function () {
        /*房间的线 */
        dynamicScaling.addScalingObject(this.roomAllTongue);
        /**房间内的道具 */
        dynamicScaling.addScalingObject(this.propLayer);
        /**房间内的青蛙 */
        dynamicScaling.addScalingObject(this.gameFrog);
    };
    /**玩家死亡 */
    xinshou.prototype.playerDiedDis = function () {
        var User_list = AIServer.getInstance().getRoomUsers();
        this.GameOver.visible = true;
        this.GameOver.showTops(User_list);
        this.userDied.GameOverDis();
    };
    /**游戏循环 */
    xinshou.prototype.game_Loop = function () {
        //this.aimgr.update();
        //this.accordingLineData();
        //this.displaMyInfo(this.myUser.userSprit);
        //this.playerUpdate();
        //this.checkDied();
        this.playerPanel.update();
        this.onLoop();
        this.check_can_breakLine();
        //this.tongueManager.updataTongue();
    };
    /**玩家伸舌 */
    xinshou.prototype.playerLoll = function () {
        this.m_createAllFrogs.frogLoll();
    };
    /**检测是否可以断线 */
    xinshou.prototype.check_can_breakLine = function () {
        if (this.m_createAllFrogs.checkPlayerIsLine()) {
            this.playerPanel.coolDown.visible = false;
            this.playerPanel.breakLine.visible = true;
            this.playerPanel.ligature.visible = false;
        }
        else {
            this.playerPanel.breakLine.visible = false;
            this.playerPanel.ligature.visible = true;
        }
    };
    /**定时器*/
    xinshou.prototype.BeginTimes = function () {
        this.game_Timer = new egret.Timer(1000 / 60, -1);
        this.game_Timer.addEventListener(egret.TimerEvent.TIMER, this.game_Loop, this);
        this.game_Timer.start();
        var game_TimerT = new egret.Timer(1000, -1);
        game_TimerT.addEventListener(egret.TimerEvent.TIMER, this.showTip, this);
        game_TimerT.start();
    };
    xinshou.prototype.showTip = function () {
        //this.isShowTop = false;
    };
    /**处理服务器发来的消息 */
    xinshou.prototype.handleInformationByServer = function (playerdata) {
        console.log(0);
        if (this.isUserDied)
            return;
        //	this.playerPanel.serverHertBeatUpdata((new Date()).valueOf());//(Date.parse(new Date().toString()));
        var porpsData = playerdata.foodsList;
        var lineData = playerdata.lineList;
        var userData = playerdata.userData;
        var virusData = playerdata.virusList;
        if (porpsData != null) {
            /**更新道具 */
            this.m_propMg.propsUpdata(porpsData);
        }
        if (userData != null) {
            // if (this.isShowTop) {
            // 	/**玩家排行榜 */
            // 	this.playerPanel.disposAllUser(userData);
            // 	this.isShowTop = false;
            // }
            //处理青蛙的移动
            this.m_createAllFrogs.disposeRoomUserMessage(userData);
            this.changebutton(userData);
            //this.diedLeaf(userData);
        }
        if (lineData != null) {
            /**处理玩家身上的线 */
            this.tongueManager.gameTongueDataUpdata(userData, lineData);
            //this.newTongueMgr.disposeRoomTongueMessage(userData, lineData);
        }
    };
    /**飞行动画中关闭吐舌 断线按钮 */
    xinshou.prototype.changebutton = function (userData) {
        for (var _i = 0, userData_2 = userData; _i < userData_2.length; _i++) {
            var e = userData_2[_i];
            if (e.userId == DataProl.account) {
                if (e.states != 0) {
                    this.playerPanel.breakLine.visible = false;
                    this.playerPanel.ligature.visible = false;
                }
                else {
                    this.playerPanel.breakLine.visible = true;
                    this.playerPanel.ligature.visible = true;
                }
            }
        }
    };
    /**显示击杀效果 */
    xinshou.prototype.disPlayKillMan = function (num) {
        var _this = this;
        var time11 = new egret.Timer(1200, 1);
        time11.start();
        time11.addEventListener(egret.TimerEvent.TIMER, function (eve) {
            var visible = DataProl.gameSceneScal + _this.lenght11 / 2500;
            if (visible >= 2) {
                visible = 2;
            }
        }, this);
        if (num > DataProl.killnumMax) {
            DataProl.killnumMax = num;
        }
        //console.log(DataProl.killnumMax + "最高连杀");
        this.playerPanel.frogKillMan(num);
        SoundManager.getInstance().effectSound = null;
        SoundManager.getInstance().playEffectSound("Kill_mp3");
    };
    /**将玩家信息显示出来 */
    xinshou.prototype.displaMyInfo = function (player) {
        this.lenght11 = player.lineLength;
        this.playerPanel.displayUserTongueLength(player.grade);
        var playertyp = player.frogType + 1 >= serverConfig.config.maxtype + 1 ? 0 : player.frogType + 1;
        this.playerPanel.displayUserClothesUpdata(playertyp);
    };
    /**初始化摇杆 */
    xinshou.prototype.yaoganInit = function () {
        this.yaogan = new roleControl();
        this.UiLayer.addChild(this.yaogan);
        this.yaogan.yaoganInit(this.stage);
        this.lockControl();
    };
    // 发送给服务器玩家的位置
    xinshou.prototype.senMessageForServerPosition = function (point) {
        if (this.myUser == null || this.myUser.userSprit == null)
            return;
        //道具醉酒
        if (this.myUser.userSprit.nowPropsType[3] == 4) {
            if (Date.now() - this.daotime >= 1000) {
                this.rr = Math.round(Math.random() * 360);
                this.daotime = Date.now();
            }
            point.x = Math.sin(this.rr / 57.3) * 815;
            point.y = Math.cos(this.rr / 57.3) * 815;
        }
        if (point.y == 0 && point.x == 0) {
            return;
        }
        var movedata = {
            "target": point,
        };
        AIServer.getInstance().clientMove(movedata);
    };
    /**生成一个道具 */
    xinshou.prototype.setOneprop = function () {
        AIPropsMgr.getInstance().NewbieOneProp(6, { x: GlobalData.GameStage_width * DataProl.gameSceneScal / 2 + 100, y: GlobalData.GameStage_height * DataProl.gameSceneScal / 2 + 100 });
    };
    /**生成六个道具 */
    xinshou.prototype.setprop = function () {
        for (var i = 0; i < 6; i++) {
            /**新手模式初始化道具 */
            AIPropsMgr.getInstance().NewbieProp(i);
            //console.log(AIPropsMgr.getInstance().NewbieProp(i));
        }
    };
    /**设置一个青蛙 */
    xinshou.prototype.setOneAi = function (x, y) {
        AIServer.getInstance().creatOneAifrog(3, { x: x, y: y });
    };
    /**设置一组连线青蛙 */
    xinshou.prototype.setLinefrog = function (x1, y1, x2, y2, level) {
        /**参数为 青蛙颜色 两只青蛙位置 */
        AIServer.getInstance().createLinefrog(3, new egret.Point(x1, y1), new egret.Point(x2, y2), level);
    };
    /**删除一组连线青蛙 */
    xinshou.prototype.delteFiretLinefrog = function (AI1, AI2) {
        AIServer.getInstance().deleteLineFrog(AI1, AI2);
    };
    /**更改单个青蛙颜色 */
    xinshou.prototype.setAitype = function () {
        AIServer.getInstance().setAitype(this.myFrog.type);
    };
    /**清空房间内ai */
    xinshou.prototype.resetAI = function () {
        AIServer.getInstance().resetAi();
    };
    /**清空房间内道具 */
    xinshou.prototype.reset_allprop = function () {
        AIPropsMgr.getInstance().cleanRoomAI();
    };
    /**设置玩家青蛙的位置 */
    xinshou.prototype.set_player_Point = function (x, y) {
        var player = AIServer.getInstance().setPlayer(x, y);
    };
    /**设置青蛙转向 */
    xinshou.prototype.set_player_Veer = function () {
        AIServer.getInstance().setAIlevel(9000);
        this.myFrog.visible = true;
        this.myFrog.rotation = 90;
    };
    /**摇杆锁定 */
    xinshou.prototype.lockControl = function () {
        if (this.yaogan == null)
            return;
        this.yaogan.recoverHandle2(); //复原小球位置
        this.yaogan.lockControl(); //摇杆锁定
        this.yaogan.visible = false; //初始摇杆隐藏
    };
    /**摇杆解锁 */
    xinshou.prototype.unlockControl = function () {
        if (this.yaogan == null)
            return;
        this.yaogan.unlockControl(); //摇杆解锁
        this.yaogan.visible = true; //初始摇杆隐藏
    };
    /**摇杆小球偏移 */
    xinshou.prototype.ControlMove = function (x, y) {
        if (this.yaogan == null)
            return;
        this.yaogan.recoverHandle3(x, y); //小球偏移
        this.yaogan.lockControl(); //此时摇杆锁定，会使玩家朝小球偏移的方向移动
        this.yaogan.visible = false; //初始摇杆隐藏
    };
    /**吐舌按钮锁定 */
    xinshou.prototype.lock_shoot = function () {
        this.playerPanel.lock_tongue(); //吐舌按钮锁定
    };
    /**吐舌按钮解锁 */
    xinshou.prototype.unlock_shoot = function () {
        this.playerPanel.unlock_tongue(); //吐舌按钮解锁
    };
    /**跳过按钮锁定 */
    xinshou.prototype.lock_skip = function () {
        this.playerPanel.lock_skip();
    };
    /**跳过按钮解锁 */
    xinshou.prototype.unlock_skip = function () {
        this.playerPanel.unlock_skip();
    };
    /**重置玩家状态 */
    xinshou.prototype.restPlayer = function () {
        var player = AIUserMgr.getInstance().get(DataProl.account);
        AIUserMgr.getInstance().resetPlayer(player); //重置玩家状态
        this.myFrog.reset2();
    };
    /**场景2 */
    xinshou.prototype.set_scene2 = function () {
        this.reset_allprop();
        this.restPlayer();
        this.set_player_Point(GlobalData.GameStage_width * DataProl.gameSceneScal / 6 + 100, GlobalData.GameStage_height * DataProl.gameSceneScal / 2 + 100);
        this.myFrog.visible = false;
        this.setLinefrog(GlobalData.GameStage_width * DataProl.gameSceneScal / 3 + 100, GlobalData.GameStage_height * DataProl.gameSceneScal / 4 + 100, GlobalData.GameStage_width * DataProl.gameSceneScal / 3 + 100, GlobalData.GameStage_height * DataProl.gameSceneScal / 4 * 3 + 100, 1); //设置一组连线青蛙 
        this.setOneprop();
        this.lockControl();
        this.yaogan.visible = false;
        this.prop_messageTimes = 7;
        this.lock_shoot();
        this.displayer_message(this.prop_messageTimes, 1000, 600);
        egret.setTimeout(this.set_player_Veer, this, 200);
        //this.set_player_Veer();
    };
    //提交玩家自己的青蛙
    xinshou.prototype.creatMyFog = function () {
        this.m_createAllFrogs.getMyFrog(DataProl.account, DataProl.login_data.nickName, 200, 200, 0, 0, DataProl.userCurrentDressUp);
        this.myUser.targetx = this.myUser.userSprit.x;
        this.myUser.targety = this.myUser.userSprit.y;
    };
    xinshou.prototype.all_Prop_message = function () {
        var _this = this;
        var hide_message = "会,使,青,蛙,处,于,一,小,段,时,间,的,隐,形,状,态";
        var ice_message = "会使,青,蛙,冻,结,一,小,段,时,间";
        var cut_message = "持,有,一,段,时,间,的,剪,刀,，,可,以,突,破,对,方,的,舌,网";
        var drink_message = "会,使,青,蛙,喝,醉,，,混,乱,不,受,控,制,一,小,段,时,间";
        var bianse_message = "可,以,改,变,青,蛙,的,颜,色";
        var heye_message = "收,集,荷,叶,会,让,小,蝌,蚪,快,速,成,长";
        var prorEnd = "全,部,道,具,都,已,经,了,解,，,让,我,们,开,始,下,一,部,分";
        var shoot = "让,我,们,尝,试,一,下,舌,头,的,威,力,吧";
        var shoot_prop = "你,用,舌,头,进,行,了,一,次,跳,跃,，,翻,过,了,对,方,的,舌,网";
        var shoot_frog_same = "不,同,颜,色,的,青,蛙,是,不,能,组,成,搭,档,的,哟,!";
        var shoot_frog_different = "太,棒,了,!,绿,色,小,青,蛙,接,受,了,你,的,舌,约,，,让,我,们,尝,试,一,下,断,线,操,作,吧,！";
        var died_mseeage = "碰,触,到,对,方,舌,网,会,被,击,杀,的,哦,！";
        var collide_message = "身,体,的,对,抗,会,让,自,己,和,对,方,都,感,到,头,晕,哦";
        var brinkLine = "断,开,舌,网,会,失,去,攻,击,手,段,哦,，,快,快,找,到,搭,档,重,新,连,接,舌,网,把,！";
        var kill = "太,厉,害,了,，,你,成,功,的,打,败,了,一,只,青,蛙,。,让,我,们,进,入,更,大,的,池,塘,吧,！";
        var end = "恭,喜,你,完,成,新,手,教,程, ,返,回,大,厅,";
        var msg1 = hide_message.split(",");
        var msg2 = ice_message.split(",");
        var msg3 = cut_message.split(",");
        var msg4 = drink_message.split(",");
        var msg5 = bianse_message.split(",");
        var msg6 = heye_message.split(",");
        var msg7 = prorEnd.split(",");
        var msg8 = shoot.split(",");
        var msg9 = shoot_prop.split(",");
        var msg10 = shoot_frog_same.split(",");
        var msg11 = shoot_frog_different.split(",");
        var msg12 = died_mseeage.split(",");
        var msg13 = collide_message.split(",");
        var msg14 = brinkLine.split(",");
        var msg15 = kill.split(",");
        var msg16 = end.split(",");
        var propMsg = [
            "会使青蛙处于一小段时间的隐形状态",
            "会使青蛙冻结一小段时间",
            "持有一段时间的剪刀，可以突破对方的舌网",
            "会使青蛙喝醉，混乱不受控制一小段时间",
            "可以改变青蛙的颜色",
            "收集荷叶会让小蝌蚪快速成长"
        ];
        this.text_array = [msg6, msg5, msg2, msg1, msg3, msg4,
            msg7, msg8, msg9, msg10, msg11, msg12, msg13, msg14, msg15, msg16];
        var listnum = -1;
        /**信息位置 */
        var msgPoint;
        /**面板尺寸 */
        var mainSize = GlobalData.GameStage.stageHeight / 4 * DataProl.gameSceneScal;
        for (var i = 0; i < 6; i++) {
            msgPoint = AIPropsMgr.getInstance().getPropPutPoint(i);
            listnum++;
            var prop_message0 = new prop_message();
            prop_message0.anchorOffsetX = prop_message0.width / 2;
            prop_message0.anchorOffsetY = -50;
            //prop_message0.scaleX = prop_message0.scaleY = mainSize / prop_message0.height;
            prop_message0.jieshao1.text = propMsg[listnum];
            prop_message0.x = msgPoint.x * DataProl.gameSceneScal + 100;
            prop_message0.y = msgPoint.y * DataProl.gameSceneScal + 100;
            prop_message0.alpha = 0;
            this.message_array.push(prop_message0);
            this.addChild(prop_message0);
            egret.Tween.get(prop_message0)
                .to({ alpha: 1 }, 1000)
                .to({ alpha: 1 }, 1000)
                .to({ alpha: 0 }, 1000)
                .call(function () {
                if (listnum == 5) {
                    _this.unlockControl(); //摇杆解锁
                    _this.unlock_skip(); //跳过按钮解锁
                }
            }, this);
        }
        this.add_message(prorEnd, 6);
        for (var i = 7; i < this.text_array.length; i++) {
            this.add_message(this.text_array[i], i);
        }
    };
    /**添加信息面板 */
    xinshou.prototype.add_message = function (message, num) {
        var prop_message0 = new prop_message();
        prop_message0.scaleX = prop_message0.scaleY = 1;
        prop_message0.jieshao1.text = message;
        prop_message0.alpha = 0;
        prop_message0.x = GlobalData.GameStage_width / 2;
        prop_message0.y = GlobalData.GameStage_height / 2;
        this.message_array.push(prop_message0);
        this.playerPanel.addChild(prop_message0);
    };
    /**新手引导  道具信息面板显示（渐入渐出） */
    xinshou.prototype.displayer_prop_message = function (num) {
        var _this = this;
        this.lockControl(); //摇杆锁定
        this.lock_skip();
        if (this.prop_messageTimes > 6 && this.prop_messageTimes < 10) {
            this.displayer_message(this.prop_messageTimes, 800, 500);
            //生成第二组连线青蛙
            this.setLinefrog(GlobalData.GameStage_width * DataProl.gameSceneScal / 3 * 2 + 100, GlobalData.GameStage_height * DataProl.gameSceneScal / 4 + 100, GlobalData.GameStage_width * DataProl.gameSceneScal / 3 * 2 + 100, GlobalData.GameStage_height * DataProl.gameSceneScal / 4 * 3 + 100, 2);
            this.setOneAi(GlobalData.GameStage_width * DataProl.gameSceneScal / 6 * 5 + 100, GlobalData.GameStage_height * DataProl.gameSceneScal / 2 + 100);
            return;
        }
        this.prop_messageTimes++;
        this.message_array[num].jieshao1.text = null;
        this.message_array[num].anchorOffsetX = this.message_array[num].width / 2;
        this.message_array[num].anchorOffsetY = this.message_array[num].height / 2;
        this.message_array[num].scaleX = this.message_array[num].scaleY = 1;
        this.message_array[num].x = GlobalData.GameStage_width * DataProl.gameSceneScal / 2 + 100;
        this.message_array[num].y = GlobalData.GameStage_height * DataProl.gameSceneScal / 2 + 100;
        egret.Tween.get(this.message_array[num])
            .to({ alpha: 1 }, 500)
            .call(function () {
            _this.typer(num);
        }, this);
    };
    /**新手引导  单个信息面板显示（渐入渐出） */
    xinshou.prototype.displayer_message = function (num, x, y) {
        var _this = this;
        this.lockControl(); //摇杆锁定
        this.lock_skip();
        this.prop_messageTimes++;
        this.message_array[num].anchorOffsetX = this.message_array[num].width / 2;
        this.message_array[num].anchorOffsetY = this.message_array[num].height / 2;
        this.message_array[num].x = this.playerPanel.width / 2;
        this.message_array[num].y = this.playerPanel.height / 2;
        if (num == 14 || num == 15) {
            if (num == 14) {
                this.message_array[num].x = this.myFrog.x;
                this.message_array[num].y = this.myFrog.y;
                this.prop_messageTimes = 0;
            }
            else {
                this.add_message_to_playerPanel(num, this.playerPanel.width / 2, this.playerPanel.height / 2);
                this.prop_messageTimes = -1;
            }
        }
        if (num == 7 || num == 13) {
            this.add_message_to_playerPanel(num, this.playerPanel.width / 2, this.playerPanel.height / 2);
        }
        if (num == 8 || num == 9 || num == 10 || num == 13 || num == 11) {
            this.lock_shoot();
        }
        this.message_array[num].jieshao1.text = null;
        egret.Tween.get(this.message_array[num])
            .to({ alpha: 1 }, 500)
            .call(function () {
            _this.typer(num);
        }, this);
    };
    /**打字机
     * @param num 信息面板号
     */
    xinshou.prototype.typer = function (num) {
        this.typerNum = num;
        this.typerTimer = new egret.Timer(150, this.text_array[this.typerNum].length);
        this.typerTimer.addEventListener(egret.TimerEvent.TIMER, this.showTyper, this);
        //道具面板处理
        if (this.prop_messageTimes <= 6 && this.prop_messageTimes > 0) {
            this.typerTimer.addEventListener(egret.TimerEvent.TIMER_COMPLETE, this.dealPropTyper, this);
        }
        else {
            this.typerTimer.addEventListener(egret.TimerEvent.TIMER_COMPLETE, this.dealOneTyper, this);
        }
        this.typerTimer.start();
    };
    /**打字机显示 */
    xinshou.prototype.showTyper = function () {
        this.message_array[this.typerNum].jieshao1.text += this.text_array[this.typerNum][this.typerTimer.currentCount - 1];
    };
    /**移除打字机侦听 */
    xinshou.prototype.removeTyperListen = function () {
        this.typerTimer.stop();
        this.typerTimer.removeEventListener(egret.TimerEvent.TIMER, this.showTyper, this);
        //道具面板处理
        if (this.prop_messageTimes <= 6 && this.prop_messageTimes > 0) {
            this.typerTimer.removeEventListener(egret.TimerEvent.TIMER_COMPLETE, this.dealPropTyper, this);
        }
        else {
            this.typerTimer.removeEventListener(egret.TimerEvent.TIMER_COMPLETE, this.dealOneTyper, this);
        }
    };
    /**处理道具打字机消息 */
    xinshou.prototype.dealPropTyper = function () {
        var _this = this;
        this.removeTyperListen();
        egret.Tween.get(this.message_array[this.typerNum])
            .to({ alpha: 0 }, 500)
            .call(function () {
            _this.typerNum = -1;
            _this.unlockControl(); //摇杆解锁
            _this.unlock_skip();
            if (_this.prop_messageTimes == 6) {
                egret.Tween.get(_this.yaogan)
                    .to({ alpha: 1 }, 1000)
                    .call(function () {
                    if (_this.prop_messageTimes == 9) {
                        return;
                    }
                    _this.displayer_message(6, _this.playerPanel.width / 2, _this.playerPanel.height / 2);
                }, _this);
            }
        }, this);
    };
    /**处理单个打字机消息 */
    xinshou.prototype.dealOneTyper = function () {
        var _this = this;
        this.removeTyperListen();
        egret.Tween.get(this.message_array[this.typerNum])
            .to({ alpha: 0 }, 500)
            .call(function () {
            _this.typerNum = -1;
            _this.unlock_skip();
            if (_this.prop_messageTimes == 7) {
                _this.set_scene2();
                return;
            }
            else if (_this.prop_messageTimes == 8 || _this.prop_messageTimes == 9 || _this.prop_messageTimes == 12) {
                _this.unlock_shoot();
                return;
            }
            else if (_this.prop_messageTimes == 10) {
                _this.setAitype();
                _this.unlock_shoot();
                return;
            }
            else if (_this.prop_messageTimes == 11) {
                _this.unlock_shoot(); //摇杆解锁
                _this.delteFiretLinefrog(1, 2);
                return;
            }
            else if (_this.prop_messageTimes == 13) {
                _this.lock_shoot();
                _this.unlockControl();
                _this.ControlMove(-5, -10); //通过程序控制摇杆，使玩家向左上移动
                setTimeout(function () {
                    _this.unlockControl();
                    _this.ControlMove(5, 10); //通过程序控制摇杆，使玩家向右下移动
                }, 500);
                return;
            }
            else if (_this.prop_messageTimes == 0) {
                _this.displayer_message(15, 500, 500);
                return;
            }
            else if (_this.prop_messageTimes == -1) {
                DataProl.isXinShou = false;
                MiniNet.post('https://praying715.cn', '/wechat/isFirst', 'userid=' + DataProl.account, _this, function () {
                    DataProl.xinshouyindao = 1;
                });
                _this.backToHall();
                return;
            }
        }, this);
    };
    /**添加信息面板到玩家面板层 playerPanel*/
    xinshou.prototype.add_message_to_playerPanel = function (num, x, y) {
        this.playerPanel.addChild(this.message_array[num]);
        this.message_array[num].x = x;
        this.message_array[num].y = y;
    };
    return xinshou;
}(eui.Component));
__reflect(xinshou.prototype, "xinshou");
/**道具介绍面板 */
var prop_message = (function (_super) {
    __extends(prop_message, _super);
    function prop_message() {
        var _this = _super.call(this) || this;
        _this.skinName = "resource/assets/skins/wenzhi.exml";
        _this.init();
        return _this;
    }
    prop_message.prototype.init = function () {
        this.frogShowLayer = new eui.Component();
        this.addChild(this.frogShowLayer);
    };
    return prop_message;
}(eui.Component));
__reflect(prop_message.prototype, "prop_message");
var DataProl = (function () {
    function DataProl() {
    }
    //----------------------------------------模式选择↓
    /**是否团队战 */
    DataProl.tuanduizhan = false;
    /**是否是双摇杆模式 */
    DataProl.isDoubleRocker = false;
    /**是否创建双摇杆连线玩家 */
    DataProl.isCreateRockerPlayer = false;
    /**是否开启双摇杆模式死亡判定 */
    DataProl.isOpenRockerjudge = false;
    /**是否是单机模式 */
    DataProl.isSingleGame = false;
    /**是否是联机模式 */
    DataProl.isMultGame = false;
    /**是否连接上服务器 */
    DataProl.isEvenOnNet = false;
    //----------------------------------------邀请好友模式
    /**登陆模式
     * 0-单人模式
     * 1-房主（邀请者）
     * 2-房客（被邀请）
     */
    DataProl.loginType = 0;
    /**匹配玩家 */
    DataProl.friendId = -1;
    /**等待房间号 */
    DataProl.waitRoomId = null;
    //----------------------------------------服务器消息处理变量
    /**存储服务器道具消息 */
    DataProl.allPropData = null;
    /**是否获取到微信信息 */
    DataProl.huoqu = false;
    /**是否是游客 */
    DataProl.isVisitor = false;
    /**是否新手引导 */
    DataProl.isXinShou = false;
    /**一局死亡次数 */
    DataProl.dei = 0;
    /**今日最高名字 */
    DataProl.todayMaxName = null;
    /**今日最高分数 */
    DataProl.todayMaxGrade = 0;
    /**玩家今日最高分 */
    DataProl.todayUserMaxGrade = 0;
    /**影子青蛙Id */
    DataProl.shadowFrogId = 6666;
    DataProl.loginaddr = 'https://praying715.cn';
    /**游戏地图大小 */
    DataProl.gameMapSize = {
        "width": 2500,
        "heigth": 2500
    };
    DataProl.userCurrentDressUp = {
        "decorateId": -1,
        "trailingId": -1,
        "userMoney": -1,
        "sign": null
    };
    /**断线检测 */
    DataProl.breakLineDetection = 15000;
    /**游戏内缩放比例 */
    DataProl.gameSceneScal = 1.3;
    /**最大杀人数 */
    DataProl.killnumMax = 0;
    /**是否开启动态缩放测试 */
    DataProl.openTestScaling = false;
    /**新手引导
     * 0-没做
     * 1-做了
     */
    DataProl.xinshouyindao = 1;
    /**错误提示*/
    DataProl.maisage = 0;
    //----------------------------------------------------成就数据
    /**本局是否连过线 */
    DataProl.isEvenLine = false;
    /**本局连线的青蛙数量 */
    DataProl.connectionNumber = [];
    /**本局击杀数 */
    DataProl.struckSeveral = 0;
    /**邀请好友局数 */
    DataProl.invoteFriends = 0;
    return DataProl;
}());
__reflect(DataProl.prototype, "DataProl");
var gameGlobal = (function () {
    function gameGlobal() {
    }
    gameGlobal.global = {
        // Keys and other mathematical constants
        "KEY_ESC": 27,
        "KEY_ENTER": 13,
        "KEY_CHAT": 13,
        "KEY_FIREFOOD": 119,
        "KEY_SPLIT": 32,
        "KEY_LEFT": 37,
        "KEY_UP": 38,
        "KEY_RIGHT": 39,
        "KEY_DOWN": 40,
        "borderDraw": false,
        "pspin": -Math.PI,
        "enemySpin": -Math.PI,
        "mobile": false,
        "foodSides": 10,
        "virusSides": 20,
        "playerName": "client",
        // Canvas
        "screenWidth": 1136,
        "screenHeight": 640,
        "gameWidth": 2500,
        "gameHeight": 2500,
        "xoffset": -0,
        "yoffset": -0,
        "gameStart": false,
        "disconnected": false,
        "died": false,
        "kicked": false,
        "continuity": false,
        "startPingTime": 0,
        "toggleMassState": 0,
        "backgroundColor": 0x004672,
        "lineColor": 0xffffff,
        "tongueColor": 0xc62834,
        "watingAgain": false,
        "eleName": ["lowpoly", "food"],
        "mapLine": [50, 80, 60, 100, 40, 70, 60, 10, 20, 90, 80, 40, 20, 90, 40, 70, 50, 45, 100, 80, 76, 15, 23, 54, 88, 67, 120, 19, 44, 57, 26, 76, 51, 78, 77, 56, 44, 34, 59, 64, 12, 37, 81, 54, 13, 67],
        "frogMoveTime": 100,
        "frogRotateTime": 4,
        "cameraMoveSpeed": 100,
        "propsScal": 0.6,
        "frogShowNameLength": 7,
        "userDiesWaiting": 1000,
        "lastChangeColorTime": 0,
    };
    return gameGlobal;
}());
__reflect(gameGlobal.prototype, "gameGlobal");
/**
 * 随机名字类
 */
var randomName = (function (_super) {
    __extends(randomName, _super);
    function randomName() {
        var _this = _super.call(this) || this;
        _this.Name_list = undefined;
        return _this;
    }
    randomName.getInstance = function () {
        if (this.instance == null) {
            this.instance = new randomName();
        }
        return this.instance;
    };
    //随机昵称方法
    //读取配置文件完成
    randomName.prototype.onComplete = function () {
        var data = RES.getRes("nextMan_json"); //获取文本
        this.Name_list = data; //进行赋值
    };
    /**获取一个随机名字 */
    randomName.prototype.getRandomName = function () {
        if (this.Name_list == undefined) {
            this.onComplete();
        }
        if (!webNetworkMananger.isServerMove) {
            var index = Math.floor(Math.random() * this.Name_list.nicheng.length);
            return this.Name_list.nicheng[index];
        }
        else {
            return "1";
        }
    };
    return randomName;
}(eui.Component));
__reflect(randomName.prototype, "randomName");
/**
 * 服务器配置文件
 */
var serverConfig = (function () {
    function serverConfig() {
    }
    serverConfig.config = {
        "视野开关 ": "0-关，1-开",
        "shi": true,
        "视野范围": "0-关，1-开",
        "rangeEye": 1000,
        "host": "0.0.0.0",
        "port": 3011,
        "logpath": "logger.php",
        "foodMass": 5,
        "fireFood": 20,
        "limitSplit": 16,
        "defaultPlayerMass": 10,
        "virus": {
            "fill": "#33ff33",
            "stroke": "#19D119",
            "strokeWidth": 20,
            "defaultMass": {
                "from": 100,
                "to": 150
            },
            "splitMass": 180
        },
        "gameWidth": 2500,
        "gameHeight": 2500,
        "adminPass": "DEFAULT",
        "gameMass": 20000,
        "maxFood": 20,
        "maxVirus": 80,
        "slowBase": 4.5,
        "logChat": 0,
        "networkUpdateFactor": 40,
        "maxHeartbeatInterval": 60000,
        "foodUniformDisposition": true,
        "virusUniformDisposition": false,
        "newPlayerInitialPosition": "farthest",
        "massLossRate": 1,
        "minMassLoss": 50,
        "mergeTimer": 15,
        "maxtype": 4,
        "maxlevel": 6,
        "maxRoomCount": 1,
        "是否开启缓存池子扩容功能": "",
        "isproppoolext": true,
        "玩家死亡后退出时效": "",
        "userDeathInterval": 6000,
        "玩家初始的线长": "",
        "userInitLineLength": 150,
        "房间内玩家的最大个数": "",
        "maxUserCountByRoom": 16,
        "房间内玩家的最小个数": "",
        "minxUserCountByRoom": 3,
        "单机模式房间内玩家的最小个数": "",
        "clientMinUserCountByRoom": 15,
        "玩家的初始的速度": "",
        "initUserSpeed": 5,
        "道具总数": "",
        propMaxnum: 50,
        "道具比例": "",
        //从上到下依次为 隐身，冰，剪刀，喝酒，变色，2分荷叶，5分荷叶，20分荷叶，50分荷叶
        "propRatio": {
            "hide": 0.04,
            "ice": 0.04,
            "cut": 0.04,
            "drink": 0.08,
            "change": 0.1,
            "heart": 0.1,
            "minleaf": 0.4,
            "lesserleaf": 0.2,
            "mediumleaf": 0.06,
            "maxleaf": 0.04,
        },
        "道具的持续时间": "",
        "propBuffReationTime": {
            "hide": 6000,
            "ice": 3000,
            "cut": 12000,
            "drink": 6000,
            "dizzy": 1000,
            "heart": 1000
        },
        "断线处罚时间": "",
        "disconnection_line_time": 0,
        "新手保护时间": "",
        "newProtectTime": 3000,
        "一局游戏时间": "5*60000ms",
        "roomTime": 6000,
        "maxGameTime": 0.5,
        "gameOverWaitingTime": 10,
        "linePondLakeCount": 30,
        "gameMapBorder": 200,
        "更换颜色CD开关": "0-关，1-开",
        "ChangeTheTiming": 0,
        /**粒子特效开关  "0-关，1-开"*/
        "isParticleRun": 0,
        "绘制三角形形开关": "0-关，1-开",
        "ishexagon": 0,
        "青蛙大小": "数值越大青蛙越小",
        "size": 1500,
        "单机移动开关": "0-关，1-开",
        "SingleMobile": 0,
        "游戏内青蛙种类": "黄绿蓝",
        "maxFrigtype": 3,
        "玩家离近了以后自动连线": "0-关，1-开",
        "isLineAutoConnect": 1,
        "影子青蛙": "0-关，1-开",
        "shadowFrog": 0,
        "sqlinfo": {
            "connectionLimit": 100,
            "host": "DEFAULT",
            "user": "root",
            "password": "DEFAULT",
            "database": "DEFAULT",
            "debug": false
        },
        // { x: 600, y: 400 }
        // { x: 900, y: 400 },
        // { x: 1200, y: 400 },
        // { x: 600, y: 700 },
        // { x: 900, y: 700 },
        // { x: 1200, y: 700 }]
        /**新手引导道具*/
        "NewbieProp": [
            { x: 600, y: 700 },
            { x: 1200, y: 400 },
            { x: 900, y: 700 },
            { x: 1200, y: 700 },
            { x: 900, y: 400 },
            { x: 600, y: 400 }
        ]
    };
    return serverConfig;
}());
__reflect(serverConfig.prototype, "serverConfig");
var st_config;
(function (st_config) {
    //当前游戏宽度
    function curWidth() {
        return GlobalData.GameStage_width;
    }
    st_config.curWidth = curWidth;
    //当前游戏高度
    function curHidth() {
        return GlobalData.GameStage_height;
    }
    st_config.curHidth = curHidth;
    //设置fixedNarrow模式下EXML的分辨率自适应
    function setScreenAuto(target) {
        target.left = 0;
        target.right = 0;
        target.top = 0;
        target.bottom = 0;
    }
    st_config.setScreenAuto = setScreenAuto;
})(st_config || (st_config = {}));
/**主界面 */
var LoginMain = (function (_super) {
    __extends(LoginMain, _super);
    function LoginMain() {
        var _this = _super.call(this) || this;
        /**背景音乐 */
        _this.bgSound = new soundMgr();
        _this.skinName = "resource/assets/skins/gameLogin.exml";
        _this.width = GlobalData.GameStage_width;
        _this.height = GlobalData.GameStage_height;
        st_config.setScreenAuto(_this);
        _this.once(egret.Event.ADDED_TO_STAGE, _this.onceMain, _this);
        return _this;
    }
    /**屏幕适配 */
    LoginMain.prototype.screenAdaptation = function () {
        GlobalData.changeDpi(this.main);
        GlobalData.changeDpi(this.producerGroup);
        GlobalData.changeDpi(this.lianxiwomen);
        GlobalData.changeDpi(this.reconnection_Main);
    };
    /**初始化界面 */
    LoginMain.prototype.onceMain = function () {
        var _this = this;
        this.testXinshou.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
            _this.xinshou1 = new xinshou();
            DataProl.isXinShou = true;
            _this.addChild(_this.xinshou1);
            _this.main.visible = false;
        }, this);
    };
    LoginMain.prototype.createChildren = function () {
        this.DanJiBtn.visible = false;
        this.loginTime = new egret.Timer(200000, 0);
        this.loginTime.addEventListener(egret.TimerEvent.TIMER, this.loginDefeated, this);
        this.connecting.visible = false;
        if (DataProl.huoqu == false) {
            weixinManager.getInstance().askAccredit(this.getOpenid, this.onLoginCallBack).catch(function (e) { console.log(e); });
        }
        else {
            // DataProl.login_main_handle.StartGameMain();
            DataProl.login_main_handle = this;
            if (DataProl.login_main_handle != null) {
                DataProl.login_main_handle.loginFightServer();
                DataProl.login_main_handle.StartGameMain();
            }
            //return;
        }
        console.log("0-进入主界面");
        if (DataProl.shopaddr == null) {
            /**开启动画大时钟 */
            meterAanimation.getInstance().openClock();
            // wx.onShow(webNetworkMananger.getInstance().connect);
        }
        this.init();
        // webNetworkMananger.getInstance().connect();
    };
    /**制作人员名单 */
    LoginMain.prototype.setProducer = function () {
        var _this = this;
        this.producerGroup.visible = false;
        this.producerButton.touchEnabled = true;
        this.producerButton.addEventListener(egret.TouchEvent.TOUCH_TAP, function () {
            SoundManager.getInstance().playEffectSound("click_mp3");
            egret.Tween.removeTweens(_this.producerGundong);
            _this.producerGundong.y = GlobalData.GameStage_height;
            _this.producerGroup.visible = true;
            egret.Tween.get(_this.producerGundong, { loop: true }).to({ y: -_this.producerGundong.height }, 20000);
        }, this);
        this.producerCloseButton.touchEnabled = true;
        this.producerCloseButton.addEventListener(egret.TouchEvent.TOUCH_TAP, function () {
            _this.producerGroup.visible = false;
            SoundManager.getInstance().playEffectSound("click_mp3");
        }, this);
    };
    LoginMain.prototype.init = function () {
        var _this = this;
        this.screenAdaptation();
        this.chengjiutrue.touchEnabled = false;
        if (GlobalData.userShopData != null) {
            this.chengjiutrue.touchEnabled = true;
        }
        this.LianWangBtn.visible = false;
        this.FriendsPlay.visible = false;
        if (DataProl.isEvenOnNet) {
            this.showNetMode();
        }
        this.visitorYes.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) { _this.visitorShow.visible = false; }, this);
        SoundManager.getInstance().playBgSound(false, "1");
        SoundManager.getInstance().scene = 0;
        SoundManager.getInstance().sound_effect_switch = true;
        // wx.onShow(function () {
        //     if (SoundManager.getInstance().scene == 0) {
        //         SoundManager.getInstance().playBgSound(true, "game_mp3");
        //     }
        //     else if (SoundManager.getInstance().scene == 1) {
        //         SoundManager.getInstance().playBgSound(true, "main_mp3");
        //     }
        // });
        // this.startButton.visible = false;
        DataProl.login_main_handle = this;
        this.main.visible = true;
        this.visitorMsg.text = "连接超时，当前为游客模式";
        this.visitorShow.visible = false;
        /**商店 */
        this.shop.touchEnabled = true;
        this.shop.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
            if (DataProl.isVisitor) {
                _this.visitorShow.visible = true;
                _this.visitorMsg.text = "该机型尚不支持该功能";
            }
            else {
                _this.addChild(new gameShopData());
            }
            SoundManager.getInstance().playEffectSound("onClick_mp3");
        }, this);
    };
    /**获取用户id */
    LoginMain.prototype.getOpenid = function (callbacktmp) {
        DataProl.login_main_handle.connecting.visible = true;
        var userinfo = weixinManager.getInstance().getUserInfo();
        var code = weixinManager.getInstance().getCode();
        var isweixin = "true";
        console.log("code:" + code);
        if (userinfo == null || code == null) {
            console.log("获取玩家微信失败");
            userinfo = DataProl.login_main_handle.getRandomPlayerData();
            gameGlobal.global.playerName = userinfo.nickName;
            code = DataProl.login_main_handle.getRandomOpenId();
            isweixin = "false";
        }
        else {
            console.log("获取玩家微信成功");
        }
        DataProl.login_data = userinfo;
        DataProl.login_main_handle.loginTime.start();
        var value = 'code=' + code + '&userinfo=' + JSON.stringify(userinfo) + '&isweixin=' + isweixin;
        console.log(value);
        // MiniNet.post('http://118.89.105.237:7000', '/wechat/auth', value, this, callbacktmp);
        //    MiniNet.post('http://172.16.18.54:9000', '/wechat/auth', value, this, callbacktmp);
        // MiniNet.post('http://172.16.19.104:8000', '/wechat/auth', value, this, callbacktmp);
        //MiniNet.post('http://118.89.105.237:9000', '/wechat/auth', value, this, callbacktmp);
        MiniNet.post('https://praying715.cn', '/wechat/auth', value, this, callbacktmp);
        // //-------------------------------------------------------------测试商店服
        // DataProl.shopaddr = "https://3oojs.cn";
        // DataProl.halladdr = "https://3oojs.cn";
        // DataProl.sign = "2fc5dace50517159a8c9539f98a866a6";
        // DataProl.account = 5911;
        // DataProl.login_main_handle.connectHall();
    };
    /**登陆失败回调--游客登陆*/
    LoginMain.prototype.loginDefeated = function () {
        console.log("游客模式");
        this.connecting.visible = false;
        this.loginTime.stop();
        this.loginTime.removeEventListener(egret.TimerEvent.TIMER, this.loginDefeated, this);
        DataProl.isVisitor = true;
        DataProl.account = '00003017';
        this.StartGameMain();
    };
    /**生成随机信息 */
    LoginMain.prototype.getRandomPlayerData = function () {
        return {
            avatarUrl: "",
            city: "",
            country: "China",
            gender: 1,
            language: "zh_CN",
            nickName: randomName.getInstance().getRandomName(),
            province: ""
        };
    };
    /**生成随机id */
    LoginMain.prototype.getRandomOpenId = function (userinfo) {
        var d = Date.now();
        return d.toString();
    };
    LoginMain.prototype.test = function () {
        var value = 'userid=' + DataProl.account + '&maxLong=' + 1000 + '&name=' + gameGlobal.global.playerName;
        MiniNet.post(DataProl.loginaddr, '/wechat/update', value, this, this.post);
    };
    LoginMain.prototype.post = function () {
        console.log("111111111");
    };
    /**登录回调函数 */
    LoginMain.prototype.onLoginCallBack = function (event) {
        if (DataProl.isVisitor)
            return;
        console.log("3-登陆服回调");
        var request = event.currentTarget;
        //登陆成功跳转界面
        var res = JSON.parse(request.response);
        if (res.errcode === 0) {
            DataProl.account = res.account;
            //DataProl.nickname = res.nickname;
            DataProl.halladdr = 'https://' + res.halladdr;
            // DataProl.login_main_handle.test();
            console.log(DataProl.halladdr);
            DataProl.sign = res.sign;
            console.log("加密" + DataProl.sign);
            DataProl.shopaddr = "https://" + res.halladdr;
            //---------------------------------------------测试
            //DataProl.shopaddr = 'http://172.16.19.104:8101';
            DataProl.maxLong = parseInt(res.maxLong);
            DataProl.xinshouyindao = res.isFirst; //////从服务器接到的新手引导的值   
            console.log("是否经历过新手引导：" + DataProl.xinshouyindao);
            //连接大厅服务器
            if (DataProl.login_main_handle != null)
                DataProl.login_main_handle.connectHall();
            console.log("onLoginCallBack login sucess: 1111111111", res);
        }
        else {
            console.log("login fail: ");
        }
    };
    /**连接错误 */
    LoginMain.prototype.ConnectError = function () {
        this.connecting.visible = false;
        this.connecterror.visible = false;
        // this.tryagain.addEventListener(egret.TouchEvent.TOUCH_BEGIN,e=>{this.init();},this);
    };
    // /**连接大厅 */
    LoginMain.prototype.beConnectHall = function (callbacktmp) {
        console.log("beConnectHall start: ");
        if (DataProl.halladdr === null || callbacktmp == null) {
            console.log("get hall address fail: ");
            return;
        }
        var value = 'account=' + DataProl.account + '&sign=' + DataProl.sign;
        console.log("beConnectHall value: " + value);
        var hallADR = DataProl.halladdr;
        console.log("hallADR: " + hallADR);
        //   hallADR="http://118.89.105.237:8101";
        //     hallADR="http://127.0.0.1:8101";
        MiniNet.post(hallADR, '/login', value, this, callbacktmp);
    };
    /**链接成功 */
    LoginMain.prototype.StartGameMain = function () {
        var _this = this;
        //this.initializeModeSelection();
        this.connecting.visible = false;
        this.connecterror.visible = false;
        this.DanJiBtn.visible = true;
        this.loginTime.stop();
        this.loginTime.removeEventListener(egret.TimerEvent.TIMER, this.loginDefeated, this);
        this.setProducer();
        this.close.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
            _this.explanationMain.visible = false;
        }, this);
        //----------------------------------------------------------------------联网模式
        this.LianWangBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
            console.log("联网模式");
            SoundManager.getInstance().playEffectSound("click_mp3");
            _this.initializeModeSelection();
            webNetworkMananger.isServerMove = true;
            // let isFirst = this.isXinShou();
            // if (isFirst) {
            //     return;
            // }
            if (DataProl.gameaddr_ip == null) {
                console.log("未获取GAME地址");
                if (DataProl.login_main_handle != null) {
                    webNetworkMananger.getInstance().showErrorMessage("未获取战斗服地址，重新连接");
                    DataProl.login_main_handle.connectHall();
                    return;
                }
            }
            DataProl.loginType = 1;
            webNetworkMananger.getInstance().intoFriendWaitRoom();
            // //测试联网把下面打开
            // webNetworkMananger.getInstance().intoRoom();
        }, this);
        //----------------------------------------------------------------------好友模式
        this.FriendsPlay.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
            _this.initializeModeSelection();
            SoundManager.getInstance().playEffectSound("click_mp3");
            webNetworkMananger.isServerMove = true;
            DataProl.loginType = 1;
            webNetworkMananger.getInstance().intoFriendWaitRoom();
        }, this);
        //----------------------------------------------------------------------单机模式
        this.DanJiBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
            _this.initializeModeSelection();
            DataProl.isSingleGame = true;
            var isFirst = _this.isXinShou();
            if (isFirst) {
                return;
            }
            var value = 'userid=' + DataProl.account;
            MiniNet.post(DataProl.loginaddr, '/wechat/getTopPlayer', value, _this, _this.singMatch);
        }, this);
        // //----------------------------------------------------------------------5V5模式
        // this.tuanduizhan.addEventListener(egret.TouchEvent.TOUCH_TAP, e => {
        //     this.initializeModeSelection();
        //     DataProl.tuanduizhan = true;
        //     egret.Tween.removeTweens(this.tuanduizhan);
        //     this.tuanduizhan.y = 271.5;
        //     this.xuanz(this.tuanduizhan);
        // }, this);
        //----------------------------------------------------------------------双摇杆模式
        // this.shuangYaoGan.addEventListener(egret.TouchEvent.TOUCH_TAP, e => {
        //     DataProl.isDoubleRocker = true;
        //     webNetworkMananger.isServerMove = false;
        //     DataProl.isSingleGame = false;
        //     DataProl.tuanduizhan = false;
        //     egret.Tween.removeTweens(this.shuangYaoGan);
        //     this.shuangYaoGan.y = 368.5;
        //     this.xuanz(this.shuangYaoGan);
        // }, this);
        this.wanfa.touchEnabled = true;
        this.wanfa.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
            _this.addChild(new playmethod());
            SoundManager.getInstance().playEffectSound("click_mp3");
        }, this);
        egretToWX.getInstance().setGameHandle(this);
        this.paihang.touchEnabled = true;
        this.paihang.addEventListener(egret.TouchEvent.TOUCH_TAP, this.paihangClick, this);
        this.lianxi.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
            SoundManager.getInstance().playEffectSound("click_mp3");
            _this.lianxiwomen.visible = true;
        }, this);
        this.queding.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
            SoundManager.getInstance().playEffectSound("click_mp3");
            _this.lianxiwomen.visible = false;
        }, this);
        /**成就系统点击开启关闭*/
        this.chengjiutrue.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) {
            SoundManager.getInstance().playEffectSound("click_mp3");
            _this.addChild(new achievementMag());
        }, this);
    };
    /**获取单机匹配信息 */
    LoginMain.prototype.singMatch = function (usrRecorData) {
        var shopsData = JSON.parse(usrRecorData.target.response);
        DataProl.todayMaxName = shopsData.result[0].name;
        DataProl.todayMaxGrade = shopsData.result[0].todayScore;
        this.addChild(new MatchingInterface(1));
    };
    /**获取邀请信息 */
    LoginMain.prototype.getLaunchInfo = function () {
        return __awaiter(this, void 0, void 0, function () {
            var msg;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, platform.getLaunchOptionsSync()];
                    case 1:
                        msg = _a.sent();
                        //为邀请状态
                        if (msg != null && msg.query.key1 != null) {
                            DataProl.waitRoomId = parseInt(msg.query.key1);
                            console.log("被邀成功:房间号是" + DataProl.waitRoomId);
                            webNetworkMananger.isServerMove = true;
                            DataProl.loginType = 2;
                            webNetworkMananger.getInstance().intoFriendWaitRoom();
                        }
                        else {
                            console.log("单人模式");
                        }
                        return [2 /*return*/];
                }
            });
        });
    };
    /**测试邀请好友 */
    LoginMain.prototype.test_invite = function () {
        DataProl.waitRoomId = 29;
        console.log("被邀成功:房间号是" + DataProl.waitRoomId);
        webNetworkMananger.isServerMove = true;
        DataProl.loginType = 2;
        webNetworkMananger.getInstance().intoFriendWaitRoom();
    };
    /**初始化模式选择 */
    LoginMain.prototype.initializeModeSelection = function () {
        DataProl.isXinShou = false;
        DataProl.isSingleGame = false;
        DataProl.isDoubleRocker = false;
        DataProl.tuanduizhan = false;
        webNetworkMananger.isServerMove = false;
        DataProl.isCreateRockerPlayer = false;
        DataProl.isOpenRockerjudge = false;
        DataProl.loginType = 0;
        DataProl.friendId = -1;
    };
    /**是否触发新手引导 */
    LoginMain.prototype.isXinShou = function () {
        SoundManager.getInstance().playEffectSound("click_mp3");
        DataProl.totalLenght = 0;
        //----------------------------------------测试新手引导
        DataProl.xinshouyindao = 1;
        if (DataProl.xinshouyindao == 0) {
            DataProl.isXinShou = true;
            this.xinshou1 = new xinshou();
            this.addChild(this.xinshou1);
            this.main.visible = false;
            return true;
        }
        else {
            return false;
        }
    };
    /**显示邀请好友模式界面 */
    LoginMain.prototype.showFriendMain = function () {
        console.log("进入邀请好友界面");
        this.invitationMain = new macthRoom();
        this.addChild(this.invitationMain);
    };
    /**排行榜点击触发事件 */
    LoginMain.prototype.paihangClick = function () {
        if (DataProl.isVisitor) {
            this.visitorShow.visible = true;
            this.visitorMsg.text = "该机型尚不支持该功能";
        }
        else {
            egretToWX.getInstance().paihangBtnClick();
        }
    };
    // /**链接大厅成功 进入游戏内界面 */
    LoginMain.prototype.onConnectHallSucess = function (event) {
        console.log("onConnectHallSucess ttttt显示玩家出错的部分");
        var request = event.currentTarget;
        console.log("onLoginCallBack get ttttttttt data : ", request.response);
        var res = JSON.parse(request.response);
        if (res.errcode === 0) {
            DataProl.gameaddr_ip = "";
            DataProl.gameaddr_ip = res.clientip;
            DataProl.gameaddr_port = res.clientport;
            console.log("onLoginCallBack get data ip: ", DataProl.gameaddr_ip);
            console.log("onLoginCallBack get data port : ", DataProl.gameaddr_port);
            if (DataProl.login_main_handle != null) {
                DataProl.login_main_handle.StartGameMain();
                this.loginFightServer();
            }
        }
        else {
            console.log("onConnectHallSucess fail: ");
        }
    };
    /**登陆战斗服 */
    LoginMain.prototype.loginFightServer = function () {
        if (!DataProl.isEvenOnNet) {
            webNetworkMananger.getInstance().connect();
        }
        else {
            this.showNetMode();
        }
    };
    /**显示联网模式星球 */
    LoginMain.prototype.showNetMode = function () {
        this.LianWangBtn.visible = true;
        this.FriendsPlay.visible = false;
    };
    /**玩家登陆 */
    LoginMain.prototype.connectHall = function () {
        //this.bgSound.playerSound("resource/assets/sound/onclick.WAV", 1);
        console.log("4-connectHall start");
        if (DataProl.login_main_handle == null) {
            console.log("显示玩家出错的部分");
            return;
        }
        this.bgSound.closeSound();
        this.beConnectHall(DataProl.login_main_handle.onConnectHallSucess);
        //获得所有商品信息
        console.log("4-connectHall finish");
        //this.test_invite();
        this.getUserSkin();
    };
    //获取玩家的皮肤
    //////////////////////////////////////////////////////////////////////////////
    LoginMain.prototype.getUserSkin = function () {
        //DataProl.account = 5923;
        console.log("userId：" + DataProl.account);
        MiniNet.post(DataProl.shopaddr, '/getUserSkin', 'accountId=' + DataProl.account, this, this.getUserSkinCallBack);
    };
    /**获取皮肤回调 */
    LoginMain.prototype.getUserSkinCallBack = function (usrRecorData) {
        var shopsData = JSON.parse(usrRecorData.target.response);
        if (shopsData.shopData != null && shopsData.shopData != undefined) {
            GlobalData.userShopData = shopsData.shopData;
            console.log("获取用户皮肤成功" + shopsData);
            this.getUserRecord();
            this.saveUserSkin(shopsData.shopData);
        }
        else {
            console.log("获取玩家皮肤失败");
        }
    };
    /**获取玩家当前皮肤 */
    LoginMain.prototype.saveUserSkin = function (userSkinData) {
        DataProl.userCurrentDressUp.decorateId = -1;
        DataProl.userCurrentDressUp.trailingId = -1;
        if (userSkinData != null) {
            for (var i = 0; i < userSkinData.length; i++) {
                if (parseInt(userSkinData[i].states) == 3) {
                    if (parseInt(userSkinData[i].shopType) == 0) {
                        DataProl.userCurrentDressUp.decorateId = userSkinData[i].shopId;
                    }
                    else {
                        DataProl.userCurrentDressUp.trailingId = userSkinData[i].shopId;
                    }
                }
            }
        }
        else {
            console.log("获取玩家皮肤失败");
        }
    };
    //////////////////////////////////////////////////////////////////////////////
    /**获取记录部分 */
    //////////////////////////////////////////////////////////////////////////////
    /**获取用户成就进度 */
    LoginMain.prototype.getUserRecord = function () {
        //发送测试代码
        MiniNet.post(DataProl.shopaddr, '/getUserRecord', 'accountId=' + DataProl.account, this, this.getUserRecordCallBack);
    };
    /**获取用户成就进度回调 */
    LoginMain.prototype.getUserRecordCallBack = function (usrRecorData) {
        var shopsData = JSON.parse(usrRecorData.target.response);
        if (shopsData.shopData != null && shopsData.shopData != undefined) {
            GlobalData.usrRecorData = shopsData.shopData;
            //---------------------------------------------数据处理
            GlobalData.usrRecorData.KillNumber = parseInt(GlobalData.usrRecorData.KillNumber);
            GlobalData.usrRecorData.LineLength = parseInt(GlobalData.usrRecorData.LineLength);
            GlobalData.usrRecorData.InvoteFriends = parseInt(GlobalData.usrRecorData.InvoteFriends);
            GlobalData.usrRecorData.Weight = parseInt(GlobalData.usrRecorData.Weight);
            GlobalData.usrRecorData.VipNumbers = parseInt(GlobalData.usrRecorData.VipNumbers);
            GlobalData.attainmentTargets = shopsData.shopStandard;
            this.chengjiutrue.touchEnabled = true;
            console.log("玩家获得记录数" + shopsData);
        }
        else {
            console.log("获取玩家进度失败");
        }
    };
    //////////////////////////////////////////////////////////////////////////////
    //------------------------------------------------房间满重连部分
    /**显示重连界面 */
    LoginMain.prototype.show_reconnection_Main = function () {
        this.reconnection_Main.visible = true;
        this.reconnection_again.addEventListener(egret.TouchEvent.TOUCH_TAP, this.reconnectionAgain, this);
        this.reconnection_cancel.addEventListener(egret.TouchEvent.TOUCH_TAP, this.reconnectionCancel, this);
    };
    /**再次进入房间 */
    LoginMain.prototype.reconnectionAgain = function () {
        var m_AwesomeMessage = new awesomepackage.AwesomeMessage();
        var m_c2sEnterRoom = new awesomepackage.c2sEnterRoom();
        m_c2sEnterRoom.account = DataProl.account;
        m_c2sEnterRoom.waitRoomId = DataProl.waitRoomId;
        m_AwesomeMessage.meesageId = 1002;
        m_AwesomeMessage.data = awesomepackage.c2sEnterRoom.encode(m_c2sEnterRoom).finish();
        var buffer = awesomepackage.AwesomeMessage.encode(m_AwesomeMessage).finish();
        var byte2 = new egret.ByteArray(buffer);
        webNetworkMananger.getInstance().SendBitMeesage(byte2);
        this.reconnection_Main.visible = false;
        this.removeListener();
    };
    /**移除按钮监听 */
    LoginMain.prototype.removeListener = function () {
        this.reconnection_again.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.reconnectionAgain, this);
        this.reconnection_cancel.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.reconnectionCancel, this);
    };
    /**取消进入房间 */
    LoginMain.prototype.reconnectionCancel = function () {
        this.reconnection_Main.visible = false;
        this.removeListener();
    };
    /**登陆反馈信息 */
    LoginMain.LoginBackMess = -1;
    return LoginMain;
}(eui.Component));
__reflect(LoginMain.prototype, "LoginMain");
/**匹配界面 */
var macthRoom = (function (_super) {
    __extends(macthRoom, _super);
    function macthRoom() {
        var _this = _super.call(this) || this;
        _this.skinName = "resource/assets/skins/MatchRoom.exml";
        //适配
        st_config.setScreenAuto(_this);
        _this.init();
        return _this;
    }
    /**初始化 */
    macthRoom.prototype.init = function () {
        if (DataProl.loginType == 2) {
            this.invitation.visible = false;
            this.fightStart.visible = false;
            this.tongue.visible = false;
            this.head2.touchEnabled = true;
            //this.cancel.visible = false;
        }
        else {
            this.fightStart.visible = true;
            this.head2.touchEnabled = false;
        }
        this.ShowMsg({
            name: gameGlobal.global.playerName,
            headUrl: weixinManager.getInstance().getUserInfo().avatarUrl,
            sex: weixinManager.getInstance().getUserInfo().gender
        });
        this.fightStart.addEventListener(egret.TouchEvent.TOUCH_TAP, this.gameStart, this);
        this.invitation.addEventListener(egret.TouchEvent.TOUCH_TAP, this.Invitation, this);
        this.cancel.addEventListener(egret.TouchEvent.TOUCH_TAP, this.cancelInvitation, this);
    };
    /**取消匹配 */
    macthRoom.prototype.cancelInvitation = function () {
        var m_AwesomeMessage = new awesomepackage.AwesomeMessage();
        var m_c2sRoomExit = new awesomepackage.c2sRoomExit();
        m_c2sRoomExit.account = DataProl.account;
        m_c2sRoomExit.invoteRoomId = DataProl.waitRoomId;
        m_AwesomeMessage.data = awesomepackage.c2sRoomExit.encode(m_c2sRoomExit).finish();
        m_AwesomeMessage.meesageId = 2004;
        var buffer = awesomepackage.AwesomeMessage.encode(m_AwesomeMessage).finish();
        var byte2 = new egret.ByteArray(buffer);
        webNetworkMananger.getInstance().SendBitMeesage(byte2);
    };
    /**房间解散 */
    macthRoom.prototype.dissolvedRoom = function (result) {
        console.log("退出房间");
        DataProl.loginType = 1;
        DataProl.waitRoomId = null;
        this.parent.removeChild(this);
    };
    /**可以开始游戏 */
    macthRoom.prototype.CanStartGame = function () {
        if (DataProl.loginType == 2) {
            return;
        }
        this.fightStart.visible = true;
    };
    /**游戏开始 */
    macthRoom.prototype.gameStart = function () {
        if (this.roomNumber == 1) {
            DataProl.login_main_handle.initializeModeSelection();
            DataProl.isSingleGame = true;
            var value = 'userid=' + DataProl.account;
            MiniNet.post(DataProl.loginaddr, '/wechat/getTopPlayer', value, DataProl.login_main_handle, DataProl.login_main_handle.singMatch);
            this.cancelInvitation();
            return;
        }
        if (DataProl.waitRoomId == null) {
            return;
        }
        var m_AwesomeMessage = new awesomepackage.AwesomeMessage();
        var m_c2sRoomStart = new awesomepackage.c2sRoomStart();
        m_c2sRoomStart.invoteRoomId = DataProl.waitRoomId;
        m_AwesomeMessage.data = awesomepackage.c2sRoomStart.encode(m_c2sRoomStart).finish();
        m_AwesomeMessage.meesageId = 2003;
        var buffer = awesomepackage.AwesomeMessage.encode(m_AwesomeMessage).finish();
        var byte2 = new egret.ByteArray(buffer);
        webNetworkMananger.getInstance().SendBitMeesage(byte2);
    };
    /**邀请好友*/
    macthRoom.prototype.Invitation = function () {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        if (DataProl.waitRoomId == null) {
                            return [2 /*return*/];
                        }
                        return [4 /*yield*/, platform.activeShare(DataProl.waitRoomId)];
                    case 1:
                        _a.sent();
                        return [2 /*return*/];
                }
            });
        });
    };
    /**清空好友消息 */
    macthRoom.prototype.clearUserMsg = function () {
        if (DataProl.loginType == 2 && this.roomNumber == 2) {
            this.cancelInvitation();
        }
        if (DataProl.loginType == 1) {
            this.invitation.visible = true;
        }
        this.roomNumber == 1;
        console.log("删除好友的头像");
        this.name2.text = null;
        this.head2.source = null;
        this.tongue.visible = false;
    };
    /**显示头像 */
    macthRoom.prototype.ShowMsg = function (data) {
        /**探测性别类型 */
        var sex = Object.prototype.toString.call(data.sex);
        if (sex == "Number") {
            if (data.sex == 1) {
                sex = '男';
            }
            else {
                sex = '女';
            }
        }
        else if (sex == "Boolean") {
            if (data.sex) {
                sex = '男';
            }
            else {
                sex = '女';
            }
        }
        else {
            sex = "未知";
        }
        var msg = {
            name: data.name,
            headUrl: data.headUrl,
            sex: sex
        };
        var number = msg.name == gameGlobal.global.playerName ? 1 : 2;
        this.roomNumber = number;
        /**头像图片 */
        var headImg;
        var nameLab;
        if (number == 1) {
            console.log("加载自己的头像");
            headImg = this.head1;
            nameLab = this.name1;
            this.tongue.visible = false;
        }
        else if (number == 2) {
            console.log("加载好友的头像");
            headImg = this.head2;
            nameLab = this.name2;
            this.invitation.visible = false;
            this.tongue.visible = true;
        }
        nameLab.text = msg.name;
        if (msg.headUrl != "text" && msg.headUrl != null) {
            //headImg.source = msg.headUrl;
        }
    };
    return macthRoom;
}(eui.Component));
__reflect(macthRoom.prototype, "macthRoom");
/**匹配界面 */
var MatchingInterface = (function (_super) {
    __extends(MatchingInterface, _super);
    function MatchingInterface(gameType) {
        var _this = _super.call(this) || this;
        st_config.setScreenAuto(_this);
        _this.gameType = gameType;
        //数据初始提前
        _this.dataInit();
        _this.skinName = "resource/assets/skins/matchMain.exml";
        //显示初始在后
        _this.once(egret.Event.ADDED_TO_STAGE, _this.init, _this);
        return _this;
    }
    /**数据初始化 */
    MatchingInterface.prototype.dataInit = function () {
        this.waitManNum = 1;
        this.gameLoopTimer = new egret.Timer(1000, 0);
        if (this.gameType == 1) {
            this.singleModeTimer = new egret.Timer(400, serverConfig.config.maxUserCountByRoom);
        }
        else if (this.gameType == 2) {
        }
    };
    /**显示初始化 */
    MatchingInterface.prototype.init = function () {
        var _this = this;
        this.explanationMain.visible = false;
        this.leave.addEventListener(egret.TouchEvent.TOUCH_TAP, this.leaveFun, this);
        this.explanation.addEventListener(egret.TouchEvent.TOUCH_TAP, this.explanationFun, this);
        this.close.addEventListener(egret.TouchEvent.TOUCH_TAP, function (e) { _this.explanationMain.visible = false; }, this);
        this.userMsgShow();
        this.todayFirst();
        this.waitNumShow();
        if (this.gameType == 1) {
            this.singleModeTimer.addEventListener(egret.TimerEvent.TIMER, this.singMatchFun, this);
            this.singleModeTimer.start();
        }
        else if (this.gameType == 2) {
        }
        this.gameLoopTimer.addEventListener(egret.TimerEvent.TIMER, this.waitNumShow, this);
        this.gameLoopTimer.start();
    };
    /**单机匹配 */
    MatchingInterface.prototype.singMatchFun = function () {
        if (this.waitManNum >= serverConfig.config.maxUserCountByRoom) {
            this.waitNumShow();
            this.singleModeTimer.stop();
            this.singleModeTimer.removeEventListener(egret.TimerEvent.TIMER, this.singMatchFun, this);
            this.gameLoopTimer.stop();
            this.gameLoopTimer.removeEventListener(egret.TimerEvent.TIMER, this.waitNumShow, this);
            //UIManager.getInstance().openFirstUI(UIManager.CLASS_UI_INDEX_STORY, TweenManager.TWEEN_UI_MOVE);//(2,1)
            SceneManager.instance.SitchScene(SceneName.单机场景);
            // if (this.parent) {
            // 	this.parent.removeChild(this);
            // }
        }
        this.waitManNum++;
    };
    /**离开 */
    MatchingInterface.prototype.leaveFun = function () {
        if (this.gameType == 1) {
            this.singleModeTimer.stop();
            this.singleModeTimer.removeEventListener(egret.TimerEvent.TIMER, this.singMatchFun, this);
            this.gameLoopTimer.stop();
            this.gameLoopTimer.removeEventListener(egret.TimerEvent.TIMER, this.waitNumShow, this);
            SceneManager.instance.SitchScene(SceneName.登录场景);
            if (this.parent) {
                this.parent.removeChild(this);
            }
        }
        else if (this.gameType == 2) {
        }
    };
    /**说明 */
    MatchingInterface.prototype.explanationFun = function () {
        if (this.gameType == 1) {
            this.caption.text = "暂时没想好说什么,总之就是10分钟谁分最多谁赢!!!";
        }
        else if (this.gameType == 2) {
            this.caption.text = "还是没想好怎么说,就是和密友一起合作抢分吧!!!";
        }
        this.explanationMain.visible = true;
    };
    /**用户信息显示 */
    MatchingInterface.prototype.userMsgShow = function () {
        this.userName.text = gameGlobal.global.playerName;
        if (DataProl.maxLong == 0) {
            this.userMaxBefor.text = "历史最高 :  ---";
        }
        else {
            this.userMaxBefor.text = "历史最高 :  " + DataProl.maxLong;
        }
        if (DataProl.todayUserMaxGrade <= 0) {
            this.userMaxNow.text = "今日最高 :  ---";
        }
        else {
            this.userMaxNow.text = "今日最高 :  " + DataProl.todayUserMaxGrade;
        }
        if (weixinManager.getInstance().getUserInfo().avatarUrl) {
            this.userHeadShow.source = weixinManager.getInstance().getUserInfo().avatarUrl;
        }
    };
    /**今日第一 */
    MatchingInterface.prototype.todayFirst = function () {
        if (DataProl.todayMaxGrade <= 0) {
            this.nowFirst.text = "暂无";
        }
        else {
            this.nowFirst.text = "当前今日第一 : " + DataProl.todayMaxName + " " + DataProl.todayMaxGrade + "分";
        }
    };
    /**等待人数显示 */
    MatchingInterface.prototype.waitNumShow = function () {
        this.waitNum.text = "等待中人数 : " + this.waitManNum + "人（满" + serverConfig.config.maxUserCountByRoom + "人开赛)";
    };
    return MatchingInterface;
}(eui.Component));
__reflect(MatchingInterface.prototype, "MatchingInterface");
// TypeScript file
/**
 * 玩法
 */
var playmethod = (function (_super) {
    __extends(playmethod, _super);
    function playmethod() {
        var _this = _super.call(this) || this;
        _this.skinName = "resource/assets/skins/WanFa.exml"; //玩法界面
        _this.create();
        st_config.setScreenAuto(_this);
        return _this;
    }
    playmethod.prototype.create = function () {
        this.gui_ze.textColor = 0x8aff00;
        //this.gui_ze.touchEnabled=true;
        //添加触发事件
        this.gui_ze.addEventListener(egret.TouchEvent.TOUCH_TAP, this.guizevent, this);
        //this.dao_ju.touchEnabled=true;
        this.dao_ju.addEventListener(egret.TouchEvent.TOUCH_TAP, this.daojuevent, this);
        this.closebtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.closeBtn, this);
    };
    //规则方法，显示规则，隐藏说明
    playmethod.prototype.guizevent = function (e) {
        SoundManager.getInstance().playEffectSound("click_mp3");
        this.guize.visible = true;
        this.daoju.visible = false;
        this.gui_ze.textColor = 0x8aff00;
        this.dao_ju.textColor = 0xFFFFFF;
    };
    playmethod.prototype.daojuevent = function (e) {
        SoundManager.getInstance().playEffectSound("click_mp3");
        this.guize.visible = false;
        this.daoju.visible = true;
        this.gui_ze.textColor = 0xFFFFFF;
        this.dao_ju.textColor = 0x8aff00;
    };
    playmethod.prototype.closeBtn = function (e) {
        SoundManager.getInstance().playEffectSound("click_mp3");
        this.parent.removeChild(this);
    };
    return playmethod;
}(eui.Component));
__reflect(playmethod.prototype, "playmethod");
var wxtool = (function () {
    function wxtool() {
    }
    Object.defineProperty(wxtool, "Instance", {
        get: function () {
            if (wxtool.instance == null) {
                wxtool.instance = new wxtool();
            }
            return wxtool.instance;
        },
        enumerable: true,
        configurable: true
    });
    //打开banner广告
    wxtool.prototype.OpenBanner = function (id) {
        //创建banner广告
        var bannerAd = wx.createBannerAd({
            adUnitId: id,
            style: {
                left: 10,
                top: 76,
                width: 320
            }
        });
        //加载banner
        bannerAd.onLoad(function () {
            console.log('banner 广告加载成功');
            bannerAd.style.width = 400; //随时设置banner宽
            bannerAd.show(); //调用打开banner
        });
        bannerAd.onError(function (err) {
            console.log('banner 广告加载失败' + err);
        });
        var systemData;
        wx.getSystemInfo({
            success: function (res) {
                systemData = res;
            }
        });
    };
    //打开激励广告
    wxtool.prototype.OpenAD = function (id) {
        //创建激励广告
        var video = wx.createRewardedVideoAd({ adUnitId: id } //传入广告id
        );
        //方式：1
        //加载广告
        // video.onLoad(() => {
        // 	console.error('激励视频 广告加载成功');
        // 	console.error('执行广告打开');
        // 	video.show();//注意要先load结束，才能调用.show打开广告
        // });
        //方式：2
        video.load().then(function () {
            video.show(); //load结束调用打开广告
        }).catch(function (err) { return console.log(err.errMsg); });
        video.onError(function (err) {
            console.error("打开广告失败" + err.errMsg);
        });
        video.onClose(function (res) {
            // 用户点击了【关闭广告】按钮
            // 小于 2.1.0 的基础库版本，res 是一个 undefined
            if (res && res.isEnded || res === undefined) {
                // 正常播放结束，可以下发游戏奖励
                console.error("正常关闭广告了");
                //	console.log(GameOver.getInstance().num*3);
                //this.addmoney(GameOver.getInstance().num*3);
                video.offClose(); //注意取消这个视频的监听close
            }
            else {
                // 播放中途退出，不下发游戏奖励
                console.error("播放中途关闭广告了");
                video.offClose(); //注意取消这个视频的监听close
            }
        });
    };
    /**本地服务器加钱 */
    wxtool.prototype.addmoney = function (ss) {
        if (DataProl.isVisitor == false) {
            var value = 'accountId=' + DataProl.account + '&addMoney=' + ss;
            MiniNet.post(DataProl.shopaddr, '/shop_share', value, this, this.addMoneyCallback);
        }
    };
    wxtool.prototype.addMoneyCallback = function (userMoneyData) {
        var userMoney = JSON.parse(userMoneyData.target.response);
        DataProl.userCurrentDressUp.userMoney = userMoney;
    };
    ;
    return wxtool;
}());
__reflect(wxtool.prototype, "wxtool");
;window.Main = Main;